summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-08-31 02:42:11 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-08-31 02:42:11 (GMT)
commit34bef2694f14bbcb2794538f11ace985c22c4d11 (patch)
tree43f78db8b50fed15363fe4a6d38f693b649aeea0
parent8a98cd9e2566a2f68bb534ebe36f202aca2fd0e0 (diff)
downloadcpython-34bef2694f14bbcb2794538f11ace985c22c4d11.zip
cpython-34bef2694f14bbcb2794538f11ace985c22c4d11.tar.gz
cpython-34bef2694f14bbcb2794538f11ace985c22c4d11.tar.bz2
tg@freebsd.org
close SF patch #101354
-rw-r--r--Lib/plat-freebsd4/FCNTL.py113
-rw-r--r--Lib/plat-freebsd4/IN.py355
-rw-r--r--Lib/plat-freebsd4/SOCKET.py142
-rw-r--r--Lib/plat-freebsd4/TERMIOS.py198
-rw-r--r--Lib/plat-freebsd4/regen6
-rw-r--r--Lib/plat-freebsd5/FCNTL.py114
-rw-r--r--Lib/plat-freebsd5/IN.py355
-rw-r--r--Lib/plat-freebsd5/SOCKET.py142
-rw-r--r--Lib/plat-freebsd5/TERMIOS.py198
-rw-r--r--Lib/plat-freebsd5/regen6
10 files changed, 1629 insertions, 0 deletions
diff --git a/Lib/plat-freebsd4/FCNTL.py b/Lib/plat-freebsd4/FCNTL.py
new file mode 100644
index 0000000..3fe26ce
--- /dev/null
+++ b/Lib/plat-freebsd4/FCNTL.py
@@ -0,0 +1,113 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from sys/types.h
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/inttypes.h
+
+# Included from machine/ansi.h
+_BSD_CLOCKID_T_ = int
+_BSD_PTRDIFF_T_ = int
+_BSD_SSIZE_T_ = int
+_BSD_TIME_T_ = long
+_BSD_TIMER_T_ = int
+_BSD_CT_RUNE_T_ = int
+_BSD_PID_T_ = int
+_BSD_CLK_TCK_ = 128
+_BSD_CLOCKS_PER_SEC_ = 128
+
+# Included from machine/types.h
+def major(x): return ((int)(((u_int)(x) >> 8)&0xff))
+
+def minor(x): return ((int)((x)&0xffff00ff))
+
+
+# Included from machine/endian.h
+_QUAD_HIGHWORD = 1
+_QUAD_LOWWORD = 0
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = LITTLE_ENDIAN
+def __word_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_word(x): return \
+
+ntohl = __byte_swap_long
+ntohs = __byte_swap_word
+htonl = __byte_swap_long
+htons = __byte_swap_word
+NBBY = 8
+FD_SETSIZE = 1024
+O_RDONLY = 0x0000
+O_WRONLY = 0x0001
+O_RDWR = 0x0002
+O_ACCMODE = 0x0003
+FREAD = 0x0001
+FWRITE = 0x0002
+O_NONBLOCK = 0x0004
+O_APPEND = 0x0008
+O_SHLOCK = 0x0010
+O_EXLOCK = 0x0020
+O_ASYNC = 0x0040
+O_FSYNC = 0x0080
+O_NOFOLLOW = 0x0100
+O_CREAT = 0x0200
+O_TRUNC = 0x0400
+O_EXCL = 0x0800
+FMARK = 0x1000
+FDEFER = 0x2000
+FHASLOCK = 0x4000
+O_NOCTTY = 0x8000
+def FFLAGS(oflags): return ((oflags) + 1)
+
+def OFLAGS(fflags): return ((fflags) - 1)
+
+FAPPEND = O_APPEND
+FASYNC = O_ASYNC
+FFSYNC = O_FSYNC
+FNONBLOCK = O_NONBLOCK
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETOWN = 5
+F_SETOWN = 6
+F_GETLK = 7
+F_SETLK = 8
+F_SETLKW = 9
+FD_CLOEXEC = 1
+F_RDLCK = 1
+F_UNLCK = 2
+F_WRLCK = 3
+F_WAIT = 0x010
+F_FLOCK = 0x020
+F_POSIX = 0x040
+LOCK_SH = 0x01
+LOCK_EX = 0x02
+LOCK_NB = 0x04
+LOCK_UN = 0x08
diff --git a/Lib/plat-freebsd4/IN.py b/Lib/plat-freebsd4/IN.py
new file mode 100644
index 0000000..bca2418
--- /dev/null
+++ b/Lib/plat-freebsd4/IN.py
@@ -0,0 +1,355 @@
+# Generated by h2py from /usr/include/netinet/in.h
+IPPROTO_IP = 0
+IPPROTO_HOPOPTS = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_IPV4 = 4
+IPPROTO_IPIP = IPPROTO_IPV4
+IPPROTO_TCP = 6
+IPPROTO_ST = 7
+IPPROTO_EGP = 8
+IPPROTO_PIGP = 9
+IPPROTO_RCCMON = 10
+IPPROTO_NVPII = 11
+IPPROTO_PUP = 12
+IPPROTO_ARGUS = 13
+IPPROTO_EMCON = 14
+IPPROTO_XNET = 15
+IPPROTO_CHAOS = 16
+IPPROTO_UDP = 17
+IPPROTO_MUX = 18
+IPPROTO_MEAS = 19
+IPPROTO_HMP = 20
+IPPROTO_PRM = 21
+IPPROTO_IDP = 22
+IPPROTO_TRUNK1 = 23
+IPPROTO_TRUNK2 = 24
+IPPROTO_LEAF1 = 25
+IPPROTO_LEAF2 = 26
+IPPROTO_RDP = 27
+IPPROTO_IRTP = 28
+IPPROTO_TP = 29
+IPPROTO_BLT = 30
+IPPROTO_NSP = 31
+IPPROTO_INP = 32
+IPPROTO_SEP = 33
+IPPROTO_3PC = 34
+IPPROTO_IDPR = 35
+IPPROTO_XTP = 36
+IPPROTO_DDP = 37
+IPPROTO_CMTP = 38
+IPPROTO_TPXX = 39
+IPPROTO_IL = 40
+IPPROTO_IPV6 = 41
+IPPROTO_SDRP = 42
+IPPROTO_ROUTING = 43
+IPPROTO_FRAGMENT = 44
+IPPROTO_IDRP = 45
+IPPROTO_RSVP = 46
+IPPROTO_GRE = 47
+IPPROTO_MHRP = 48
+IPPROTO_BHA = 49
+IPPROTO_ESP = 50
+IPPROTO_AH = 51
+IPPROTO_INLSP = 52
+IPPROTO_SWIPE = 53
+IPPROTO_NHRP = 54
+IPPROTO_ICMPV6 = 58
+IPPROTO_NONE = 59
+IPPROTO_DSTOPTS = 60
+IPPROTO_AHIP = 61
+IPPROTO_CFTP = 62
+IPPROTO_HELLO = 63
+IPPROTO_SATEXPAK = 64
+IPPROTO_KRYPTOLAN = 65
+IPPROTO_RVD = 66
+IPPROTO_IPPC = 67
+IPPROTO_ADFS = 68
+IPPROTO_SATMON = 69
+IPPROTO_VISA = 70
+IPPROTO_IPCV = 71
+IPPROTO_CPNX = 72
+IPPROTO_CPHB = 73
+IPPROTO_WSN = 74
+IPPROTO_PVP = 75
+IPPROTO_BRSATMON = 76
+IPPROTO_ND = 77
+IPPROTO_WBMON = 78
+IPPROTO_WBEXPAK = 79
+IPPROTO_EON = 80
+IPPROTO_VMTP = 81
+IPPROTO_SVMTP = 82
+IPPROTO_VINES = 83
+IPPROTO_TTP = 84
+IPPROTO_IGP = 85
+IPPROTO_DGP = 86
+IPPROTO_TCF = 87
+IPPROTO_IGRP = 88
+IPPROTO_OSPFIGP = 89
+IPPROTO_SRPC = 90
+IPPROTO_LARP = 91
+IPPROTO_MTP = 92
+IPPROTO_AX25 = 93
+IPPROTO_IPEIP = 94
+IPPROTO_MICP = 95
+IPPROTO_SCCSP = 96
+IPPROTO_ETHERIP = 97
+IPPROTO_ENCAP = 98
+IPPROTO_APES = 99
+IPPROTO_GMTP = 100
+IPPROTO_IPCOMP = 108
+IPPROTO_PIM = 103
+IPPROTO_PGM = 113
+IPPROTO_DIVERT = 254
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPROTO_DONE = 257
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_HIFIRSTAUTO = 49152
+IPPORT_HILASTAUTO = 65535
+IPPORT_RESERVEDSTART = 600
+def IN_CLASSA(i): return (((u_int32_t)(i) & 0x80000000) == 0)
+
+IN_CLASSA_NET = 0xff000000
+IN_CLASSA_NSHIFT = 24
+IN_CLASSA_HOST = 0x00ffffff
+IN_CLASSA_MAX = 128
+def IN_CLASSB(i): return (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
+
+IN_CLASSB_NET = 0xffff0000
+IN_CLASSB_NSHIFT = 16
+IN_CLASSB_HOST = 0x0000ffff
+IN_CLASSB_MAX = 65536
+def IN_CLASSC(i): return (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
+
+IN_CLASSC_NET = 0xffffff00
+IN_CLASSC_NSHIFT = 8
+IN_CLASSC_HOST = 0x000000ff
+def IN_CLASSD(i): return (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
+
+def IN_BADCLASS(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_NONE = 0xffffffff
+IN_LOOPBACKNET = 127
+INET_ADDRSTRLEN = 16
+IP_OPTIONS = 1
+IP_HDRINCL = 2
+IP_TOS = 3
+IP_TTL = 4
+IP_RECVOPTS = 5
+IP_RECVRETOPTS = 6
+IP_RECVDSTADDR = 7
+IP_RETOPTS = 8
+IP_MULTICAST_IF = 9
+IP_MULTICAST_TTL = 10
+IP_MULTICAST_LOOP = 11
+IP_ADD_MEMBERSHIP = 12
+IP_DROP_MEMBERSHIP = 13
+IP_MULTICAST_VIF = 14
+IP_RSVP_ON = 15
+IP_RSVP_OFF = 16
+IP_RSVP_VIF_ON = 17
+IP_RSVP_VIF_OFF = 18
+IP_PORTRANGE = 19
+IP_RECVIF = 20
+IP_IPSEC_POLICY = 21
+IP_FAITH = 22
+IP_FW_ADD = 50
+IP_FW_DEL = 51
+IP_FW_FLUSH = 52
+IP_FW_ZERO = 53
+IP_FW_GET = 54
+IP_FW_RESETLOG = 55
+IP_DUMMYNET_CONFIGURE = 60
+IP_DUMMYNET_DEL = 61
+IP_DUMMYNET_FLUSH = 62
+IP_DUMMYNET_GET = 64
+IP_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
+IP_PORTRANGE_DEFAULT = 0
+IP_PORTRANGE_HIGH = 1
+IP_PORTRANGE_LOW = 2
+IPPROTO_MAXID = (IPPROTO_AH + 1)
+IPCTL_FORWARDING = 1
+IPCTL_SENDREDIRECTS = 2
+IPCTL_DEFTTL = 3
+IPCTL_DEFMTU = 4
+IPCTL_RTEXPIRE = 5
+IPCTL_RTMINEXPIRE = 6
+IPCTL_RTMAXCACHE = 7
+IPCTL_SOURCEROUTE = 8
+IPCTL_DIRECTEDBROADCAST = 9
+IPCTL_INTRQMAXLEN = 10
+IPCTL_INTRQDROPS = 11
+IPCTL_STATS = 12
+IPCTL_ACCEPTSOURCEROUTE = 13
+IPCTL_FASTFORWARDING = 14
+IPCTL_KEEPFAITH = 15
+IPCTL_GIF_TTL = 16
+IPCTL_MAXID = 17
+
+# Included from netinet6/in6.h
+
+# Included from sys/queue.h
+def SLIST_HEAD_INITIALIZER(head): return \
+
+def SLIST_ENTRY(type): return \
+
+def STAILQ_HEAD_INITIALIZER(head): return \
+
+def STAILQ_ENTRY(type): return \
+
+def LIST_HEAD_INITIALIZER(head): return \
+
+def LIST_ENTRY(type): return \
+
+def TAILQ_HEAD_INITIALIZER(head): return \
+
+def TAILQ_ENTRY(type): return \
+
+def CIRCLEQ_ENTRY(type): return \
+
+__KAME_VERSION = "20000701/FreeBSD-current"
+IPV6PORT_RESERVED = 1024
+IPV6PORT_ANONMIN = 49152
+IPV6PORT_ANONMAX = 65535
+IPV6PORT_RESERVEDMIN = 600
+IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1)
+INET6_ADDRSTRLEN = 46
+IPV6_ADDR_INT32_ONE = 1
+IPV6_ADDR_INT32_TWO = 2
+IPV6_ADDR_INT32_MNL = 0xff010000
+IPV6_ADDR_INT32_MLL = 0xff020000
+IPV6_ADDR_INT32_SMP = 0x0000ffff
+IPV6_ADDR_INT16_ULL = 0xfe80
+IPV6_ADDR_INT16_USL = 0xfec0
+IPV6_ADDR_INT16_MLL = 0xff02
+IPV6_ADDR_INT32_ONE = 0x01000000
+IPV6_ADDR_INT32_TWO = 0x02000000
+IPV6_ADDR_INT32_MNL = 0x000001ff
+IPV6_ADDR_INT32_MLL = 0x000002ff
+IPV6_ADDR_INT32_SMP = 0xffff0000
+IPV6_ADDR_INT16_ULL = 0x80fe
+IPV6_ADDR_INT16_USL = 0xc0fe
+IPV6_ADDR_INT16_MLL = 0x02ff
+def IN6_IS_ADDR_UNSPECIFIED(a): return \
+
+def IN6_IS_ADDR_LOOPBACK(a): return \
+
+def IN6_IS_ADDR_V4COMPAT(a): return \
+
+def IN6_IS_ADDR_V4MAPPED(a): return \
+
+IPV6_ADDR_SCOPE_NODELOCAL = 0x01
+IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
+IPV6_ADDR_SCOPE_SITELOCAL = 0x05
+IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
+IPV6_ADDR_SCOPE_GLOBAL = 0x0e
+__IPV6_ADDR_SCOPE_NODELOCAL = 0x01
+__IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
+__IPV6_ADDR_SCOPE_SITELOCAL = 0x05
+__IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
+__IPV6_ADDR_SCOPE_GLOBAL = 0x0e
+def IN6_IS_ADDR_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_GLOBAL(a): return \
+
+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_GLOBAL(a): return \
+
+def IN6_IS_SCOPE_LINKLOCAL(a): return \
+
+IPV6_OPTIONS = 1
+IPV6_RECVOPTS = 5
+IPV6_RECVRETOPTS = 6
+IPV6_RECVDSTADDR = 7
+IPV6_RETOPTS = 8
+IPV6_SOCKOPT_RESERVED1 = 3
+IPV6_UNICAST_HOPS = 4
+IPV6_MULTICAST_IF = 9
+IPV6_MULTICAST_HOPS = 10
+IPV6_MULTICAST_LOOP = 11
+IPV6_JOIN_GROUP = 12
+IPV6_LEAVE_GROUP = 13
+IPV6_PORTRANGE = 14
+ICMP6_FILTER = 18
+IPV6_PKTINFO = 19
+IPV6_HOPLIMIT = 20
+IPV6_NEXTHOP = 21
+IPV6_HOPOPTS = 22
+IPV6_DSTOPTS = 23
+IPV6_RTHDR = 24
+IPV6_PKTOPTIONS = 25
+IPV6_CHECKSUM = 26
+IPV6_BINDV6ONLY = 27
+IPV6_IPSEC_POLICY = 28
+IPV6_FAITH = 29
+IPV6_FW_ADD = 30
+IPV6_FW_DEL = 31
+IPV6_FW_FLUSH = 32
+IPV6_FW_ZERO = 33
+IPV6_FW_GET = 34
+IPV6_RTHDR_LOOSE = 0
+IPV6_RTHDR_STRICT = 1
+IPV6_RTHDR_TYPE_0 = 0
+IPV6_DEFAULT_MULTICAST_HOPS = 1
+IPV6_DEFAULT_MULTICAST_LOOP = 1
+IPV6_PORTRANGE_DEFAULT = 0
+IPV6_PORTRANGE_HIGH = 1
+IPV6_PORTRANGE_LOW = 2
+IPV6PROTO_MAXID = (IPPROTO_PIM + 1)
+IPV6CTL_FORWARDING = 1
+IPV6CTL_SENDREDIRECTS = 2
+IPV6CTL_DEFHLIM = 3
+IPV6CTL_DEFMTU = 4
+IPV6CTL_FORWSRCRT = 5
+IPV6CTL_STATS = 6
+IPV6CTL_MRTSTATS = 7
+IPV6CTL_MRTPROTO = 8
+IPV6CTL_MAXFRAGPACKETS = 9
+IPV6CTL_SOURCECHECK = 10
+IPV6CTL_SOURCECHECK_LOGINT = 11
+IPV6CTL_ACCEPT_RTADV = 12
+IPV6CTL_KEEPFAITH = 13
+IPV6CTL_LOG_INTERVAL = 14
+IPV6CTL_HDRNESTLIMIT = 15
+IPV6CTL_DAD_COUNT = 16
+IPV6CTL_AUTO_FLOWLABEL = 17
+IPV6CTL_DEFMCASTHLIM = 18
+IPV6CTL_GIF_HLIM = 19
+IPV6CTL_KAME_VERSION = 20
+IPV6CTL_USE_DEPRECATED = 21
+IPV6CTL_RR_PRUNE = 22
+IPV6CTL_MAPPED_ADDR = 23
+IPV6CTL_BINDV6ONLY = 24
+IPV6CTL_RTEXPIRE = 25
+IPV6CTL_RTMINEXPIRE = 26
+IPV6CTL_RTMAXCACHE = 27
+IPV6CTL_MAXID = 28
diff --git a/Lib/plat-freebsd4/SOCKET.py b/Lib/plat-freebsd4/SOCKET.py
new file mode 100644
index 0000000..6c6f34a
--- /dev/null
+++ b/Lib/plat-freebsd4/SOCKET.py
@@ -0,0 +1,142 @@
+# Generated by h2py from /usr/include/sys/socket.h
+SOCK_STREAM = 1
+SOCK_DGRAM = 2
+SOCK_RAW = 3
+SOCK_RDM = 4
+SOCK_SEQPACKET = 5
+SO_DEBUG = 0x0001
+SO_ACCEPTCONN = 0x0002
+SO_REUSEADDR = 0x0004
+SO_KEEPALIVE = 0x0008
+SO_DONTROUTE = 0x0010
+SO_BROADCAST = 0x0020
+SO_USELOOPBACK = 0x0040
+SO_LINGER = 0x0080
+SO_OOBINLINE = 0x0100
+SO_REUSEPORT = 0x0200
+SO_TIMESTAMP = 0x0400
+SO_ACCEPTFILTER = 0x1000
+SO_SNDBUF = 0x1001
+SO_RCVBUF = 0x1002
+SO_SNDLOWAT = 0x1003
+SO_RCVLOWAT = 0x1004
+SO_SNDTIMEO = 0x1005
+SO_RCVTIMEO = 0x1006
+SO_ERROR = 0x1007
+SO_TYPE = 0x1008
+SOL_SOCKET = 0xffff
+AF_UNSPEC = 0
+AF_LOCAL = 1
+AF_UNIX = AF_LOCAL
+AF_INET = 2
+AF_IMPLINK = 3
+AF_PUP = 4
+AF_CHAOS = 5
+AF_NS = 6
+AF_ISO = 7
+AF_OSI = AF_ISO
+AF_ECMA = 8
+AF_DATAKIT = 9
+AF_CCITT = 10
+AF_SNA = 11
+AF_DECnet = 12
+AF_DLI = 13
+AF_LAT = 14
+AF_HYLINK = 15
+AF_APPLETALK = 16
+AF_ROUTE = 17
+AF_LINK = 18
+pseudo_AF_XTP = 19
+AF_COIP = 20
+AF_CNT = 21
+pseudo_AF_RTIP = 22
+AF_IPX = 23
+AF_SIP = 24
+pseudo_AF_PIP = 25
+AF_ISDN = 26
+AF_E164 = AF_ISDN
+pseudo_AF_KEY = 27
+AF_INET6 = 28
+AF_NATM = 29
+AF_ATM = 30
+pseudo_AF_HDRCMPLT = 31
+AF_NETGRAPH = 32
+AF_MAX = 33
+SOCK_MAXADDRLEN = 255
+_SS_MAXSIZE = 128
+PF_UNSPEC = AF_UNSPEC
+PF_LOCAL = AF_LOCAL
+PF_UNIX = PF_LOCAL
+PF_INET = AF_INET
+PF_IMPLINK = AF_IMPLINK
+PF_PUP = AF_PUP
+PF_CHAOS = AF_CHAOS
+PF_NS = AF_NS
+PF_ISO = AF_ISO
+PF_OSI = AF_ISO
+PF_ECMA = AF_ECMA
+PF_DATAKIT = AF_DATAKIT
+PF_CCITT = AF_CCITT
+PF_SNA = AF_SNA
+PF_DECnet = AF_DECnet
+PF_DLI = AF_DLI
+PF_LAT = AF_LAT
+PF_HYLINK = AF_HYLINK
+PF_APPLETALK = AF_APPLETALK
+PF_ROUTE = AF_ROUTE
+PF_LINK = AF_LINK
+PF_XTP = pseudo_AF_XTP
+PF_COIP = AF_COIP
+PF_CNT = AF_CNT
+PF_SIP = AF_SIP
+PF_IPX = AF_IPX
+PF_RTIP = pseudo_AF_RTIP
+PF_PIP = pseudo_AF_PIP
+PF_ISDN = AF_ISDN
+PF_KEY = pseudo_AF_KEY
+PF_INET6 = AF_INET6
+PF_NATM = AF_NATM
+PF_ATM = AF_ATM
+PF_NETGRAPH = AF_NETGRAPH
+PF_MAX = AF_MAX
+NET_MAXID = AF_MAX
+NET_RT_DUMP = 1
+NET_RT_FLAGS = 2
+NET_RT_IFLIST = 3
+NET_RT_MAXID = 4
+SOMAXCONN = 128
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_DONTWAIT = 0x80
+MSG_EOF = 0x100
+MSG_COMPAT = 0x8000
+CMGROUP_MAX = 16
+SCM_RIGHTS = 0x01
+SCM_TIMESTAMP = 0x02
+SCM_CREDS = 0x03
+SHUT_RD = 0
+SHUT_WR = 1
+SHUT_RDWR = 2
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
diff --git a/Lib/plat-freebsd4/TERMIOS.py b/Lib/plat-freebsd4/TERMIOS.py
new file mode 100644
index 0000000..783c617
--- /dev/null
+++ b/Lib/plat-freebsd4/TERMIOS.py
@@ -0,0 +1,198 @@
+# Generated by h2py from /usr/include/termios.h
+VEOF = 0
+VEOL = 1
+VEOL2 = 2
+VERASE = 3
+VWERASE = 4
+VKILL = 5
+VREPRINT = 6
+VINTR = 8
+VQUIT = 9
+VSUSP = 10
+VDSUSP = 11
+VSTART = 12
+VSTOP = 13
+VLNEXT = 14
+VDISCARD = 15
+VMIN = 16
+VTIME = 17
+VSTATUS = 18
+NCCS = 20
+_POSIX_VDISABLE = 0xff
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IXANY = 0x00000800
+IMAXBEL = 0x00002000
+OPOST = 0x00000001
+ONLCR = 0x00000002
+OXTABS = 0x00000004
+ONOEOT = 0x00000008
+CIGNORE = 0x00000001
+CSIZE = 0x00000300
+CS5 = 0x00000000
+CS6 = 0x00000100
+CS7 = 0x00000200
+CS8 = 0x00000300
+CSTOPB = 0x00000400
+CREAD = 0x00000800
+PARENB = 0x00001000
+PARODD = 0x00002000
+HUPCL = 0x00004000
+CLOCAL = 0x00008000
+CCTS_OFLOW = 0x00010000
+CRTS_IFLOW = 0x00020000
+CDTR_IFLOW = 0x00040000
+CDSR_OFLOW = 0x00080000
+CCAR_OFLOW = 0x00100000
+MDMBUF = 0x00100000
+ECHOKE = 0x00000001
+ECHOE = 0x00000002
+ECHOK = 0x00000004
+ECHO = 0x00000008
+ECHONL = 0x00000010
+ECHOPRT = 0x00000020
+ECHOCTL = 0x00000040
+ISIG = 0x00000080
+ICANON = 0x00000100
+ALTWERASE = 0x00000200
+IEXTEN = 0x00000400
+EXTPROC = 0x00000800
+TOSTOP = 0x00400000
+FLUSHO = 0x00800000
+NOKERNINFO = 0x02000000
+PENDIN = 0x20000000
+NOFLSH = 0x80000000
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCSASOFT = 0x10
+B0 = 0
+B50 = 50
+B75 = 75
+B110 = 110
+B134 = 134
+B150 = 150
+B200 = 200
+B300 = 300
+B600 = 600
+B1200 = 1200
+B1800 = 1800
+B2400 = 2400
+B4800 = 4800
+B9600 = 9600
+B19200 = 19200
+B38400 = 38400
+B7200 = 7200
+B14400 = 14400
+B28800 = 28800
+B57600 = 57600
+B76800 = 76800
+B115200 = 115200
+B230400 = 230400
+EXTA = 19200
+EXTB = 38400
+TCIFLUSH = 1
+TCOFLUSH = 2
+TCIOFLUSH = 3
+TCOOFF = 1
+TCOON = 2
+TCIOFF = 3
+TCION = 4
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/ttycom.h
+
+# Included from sys/ioccom.h
+IOCPARM_MASK = 0x1fff
+def IOCPARM_LEN(x): return (((x) >> 16) & IOCPARM_MASK)
+
+def IOCBASECMD(x): return ((x) & ~(IOCPARM_MASK << 16))
+
+def IOCGROUP(x): return (((x) >> 8) & 0xff)
+
+IOC_VOID = 0x20000000
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+IOC_DIRMASK = 0xe0000000
+TIOCM_LE = 0001
+TIOCM_DTR = 0002
+TIOCM_RTS = 0004
+TIOCM_ST = 0010
+TIOCM_SR = 0020
+TIOCM_CTS = 0040
+TIOCM_CAR = 0100
+TIOCM_CD = TIOCM_CAR
+TIOCM_RNG = 0200
+TIOCM_RI = TIOCM_RNG
+TIOCM_DSR = 0400
+TIOCPKT_DATA = 0x00
+TIOCPKT_FLUSHREAD = 0x01
+TIOCPKT_FLUSHWRITE = 0x02
+TIOCPKT_STOP = 0x04
+TIOCPKT_START = 0x08
+TIOCPKT_NOSTOP = 0x10
+TIOCPKT_DOSTOP = 0x20
+TIOCPKT_IOCTL = 0x40
+def UIOCCMD(n): return _IO(ord('u'), n)
+
+TTYDISC = 0
+SLIPDISC = 4
+PPPDISC = 5
+NETGRAPHDISC = 6
+
+# Included from sys/ttydefaults.h
+TTYDEF_IFLAG = (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+TTYDEF_OFLAG = (OPOST | ONLCR)
+TTYDEF_LFLAG = (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+TTYDEF_CFLAG = (CREAD | CS8 | HUPCL)
+TTYDEF_SPEED = (B9600)
+def CTRL(x): return (x&037)
+
+CEOF = CTRL(ord('d'))
+CEOL = 0xff
+CERASE = 0177
+CINTR = CTRL(ord('c'))
+CSTATUS = CTRL(ord('t'))
+CKILL = CTRL(ord('u'))
+CMIN = 1
+CQUIT = 034
+CSUSP = CTRL(ord('z'))
+CTIME = 0
+CDSUSP = CTRL(ord('y'))
+CSTART = CTRL(ord('q'))
+CSTOP = CTRL(ord('s'))
+CLNEXT = CTRL(ord('v'))
+CDISCARD = CTRL(ord('o'))
+CWERASE = CTRL(ord('w'))
+CREPRINT = CTRL(ord('r'))
+CEOT = CEOF
+CBRK = CEOL
+CRPRNT = CREPRINT
+CFLUSH = CDISCARD
diff --git a/Lib/plat-freebsd4/regen b/Lib/plat-freebsd4/regen
new file mode 100644
index 0000000..5c502c2
--- /dev/null
+++ b/Lib/plat-freebsd4/regen
@@ -0,0 +1,6 @@
+#! /bin/sh
+set -v
+python ../../Tools/scripts/h2py.py /usr/include/fcntl.h
+python ../../Tools/scripts/h2py.py /usr/include/sys/socket.h
+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
+python ../../Tools/scripts/h2py.py /usr/include/termios.h
diff --git a/Lib/plat-freebsd5/FCNTL.py b/Lib/plat-freebsd5/FCNTL.py
new file mode 100644
index 0000000..6c0facd
--- /dev/null
+++ b/Lib/plat-freebsd5/FCNTL.py
@@ -0,0 +1,114 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from sys/types.h
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/inttypes.h
+
+# Included from machine/ansi.h
+_BSD_CLOCKID_T_ = int
+_BSD_PTRDIFF_T_ = int
+_BSD_SSIZE_T_ = int
+_BSD_TIME_T_ = long
+_BSD_TIMER_T_ = int
+_BSD_CT_RUNE_T_ = int
+_BSD_PID_T_ = int
+_BSD_CLK_TCK_ = 128
+_BSD_CLOCKS_PER_SEC_ = 128
+
+# Included from machine/types.h
+def major(x): return ((int)(((u_int)(x) >> 8)&0xff))
+
+def minor(x): return ((int)((x)&0xffff00ff))
+
+
+# Included from machine/endian.h
+_QUAD_HIGHWORD = 1
+_QUAD_LOWWORD = 0
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = LITTLE_ENDIAN
+def __word_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_word(x): return \
+
+ntohl = __byte_swap_long
+ntohs = __byte_swap_word
+htonl = __byte_swap_long
+htons = __byte_swap_word
+NBBY = 8
+FD_SETSIZE = 1024
+O_RDONLY = 0x0000
+O_WRONLY = 0x0001
+O_RDWR = 0x0002
+O_ACCMODE = 0x0003
+FREAD = 0x0001
+FWRITE = 0x0002
+O_NONBLOCK = 0x0004
+O_APPEND = 0x0008
+O_SHLOCK = 0x0010
+O_EXLOCK = 0x0020
+O_ASYNC = 0x0040
+O_FSYNC = 0x0080
+O_NOFOLLOW = 0x0100
+O_CREAT = 0x0200
+O_TRUNC = 0x0400
+O_EXCL = 0x0800
+FMARK = 0x1000
+FDEFER = 0x2000
+FHASLOCK = 0x4000
+O_NOCTTY = 0x8000
+def FFLAGS(oflags): return ((oflags) + 1)
+
+def OFLAGS(fflags): return ((fflags) - 1)
+
+FAPPEND = O_APPEND
+FASYNC = O_ASYNC
+FFSYNC = O_FSYNC
+FNONBLOCK = O_NONBLOCK
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+FPOSIXSHM = O_NOFOLLOW
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETOWN = 5
+F_SETOWN = 6
+F_GETLK = 7
+F_SETLK = 8
+F_SETLKW = 9
+FD_CLOEXEC = 1
+F_RDLCK = 1
+F_UNLCK = 2
+F_WRLCK = 3
+F_WAIT = 0x010
+F_FLOCK = 0x020
+F_POSIX = 0x040
+LOCK_SH = 0x01
+LOCK_EX = 0x02
+LOCK_NB = 0x04
+LOCK_UN = 0x08
diff --git a/Lib/plat-freebsd5/IN.py b/Lib/plat-freebsd5/IN.py
new file mode 100644
index 0000000..bca2418
--- /dev/null
+++ b/Lib/plat-freebsd5/IN.py
@@ -0,0 +1,355 @@
+# Generated by h2py from /usr/include/netinet/in.h
+IPPROTO_IP = 0
+IPPROTO_HOPOPTS = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_IPV4 = 4
+IPPROTO_IPIP = IPPROTO_IPV4
+IPPROTO_TCP = 6
+IPPROTO_ST = 7
+IPPROTO_EGP = 8
+IPPROTO_PIGP = 9
+IPPROTO_RCCMON = 10
+IPPROTO_NVPII = 11
+IPPROTO_PUP = 12
+IPPROTO_ARGUS = 13
+IPPROTO_EMCON = 14
+IPPROTO_XNET = 15
+IPPROTO_CHAOS = 16
+IPPROTO_UDP = 17
+IPPROTO_MUX = 18
+IPPROTO_MEAS = 19
+IPPROTO_HMP = 20
+IPPROTO_PRM = 21
+IPPROTO_IDP = 22
+IPPROTO_TRUNK1 = 23
+IPPROTO_TRUNK2 = 24
+IPPROTO_LEAF1 = 25
+IPPROTO_LEAF2 = 26
+IPPROTO_RDP = 27
+IPPROTO_IRTP = 28
+IPPROTO_TP = 29
+IPPROTO_BLT = 30
+IPPROTO_NSP = 31
+IPPROTO_INP = 32
+IPPROTO_SEP = 33
+IPPROTO_3PC = 34
+IPPROTO_IDPR = 35
+IPPROTO_XTP = 36
+IPPROTO_DDP = 37
+IPPROTO_CMTP = 38
+IPPROTO_TPXX = 39
+IPPROTO_IL = 40
+IPPROTO_IPV6 = 41
+IPPROTO_SDRP = 42
+IPPROTO_ROUTING = 43
+IPPROTO_FRAGMENT = 44
+IPPROTO_IDRP = 45
+IPPROTO_RSVP = 46
+IPPROTO_GRE = 47
+IPPROTO_MHRP = 48
+IPPROTO_BHA = 49
+IPPROTO_ESP = 50
+IPPROTO_AH = 51
+IPPROTO_INLSP = 52
+IPPROTO_SWIPE = 53
+IPPROTO_NHRP = 54
+IPPROTO_ICMPV6 = 58
+IPPROTO_NONE = 59
+IPPROTO_DSTOPTS = 60
+IPPROTO_AHIP = 61
+IPPROTO_CFTP = 62
+IPPROTO_HELLO = 63
+IPPROTO_SATEXPAK = 64
+IPPROTO_KRYPTOLAN = 65
+IPPROTO_RVD = 66
+IPPROTO_IPPC = 67
+IPPROTO_ADFS = 68
+IPPROTO_SATMON = 69
+IPPROTO_VISA = 70
+IPPROTO_IPCV = 71
+IPPROTO_CPNX = 72
+IPPROTO_CPHB = 73
+IPPROTO_WSN = 74
+IPPROTO_PVP = 75
+IPPROTO_BRSATMON = 76
+IPPROTO_ND = 77
+IPPROTO_WBMON = 78
+IPPROTO_WBEXPAK = 79
+IPPROTO_EON = 80
+IPPROTO_VMTP = 81
+IPPROTO_SVMTP = 82
+IPPROTO_VINES = 83
+IPPROTO_TTP = 84
+IPPROTO_IGP = 85
+IPPROTO_DGP = 86
+IPPROTO_TCF = 87
+IPPROTO_IGRP = 88
+IPPROTO_OSPFIGP = 89
+IPPROTO_SRPC = 90
+IPPROTO_LARP = 91
+IPPROTO_MTP = 92
+IPPROTO_AX25 = 93
+IPPROTO_IPEIP = 94
+IPPROTO_MICP = 95
+IPPROTO_SCCSP = 96
+IPPROTO_ETHERIP = 97
+IPPROTO_ENCAP = 98
+IPPROTO_APES = 99
+IPPROTO_GMTP = 100
+IPPROTO_IPCOMP = 108
+IPPROTO_PIM = 103
+IPPROTO_PGM = 113
+IPPROTO_DIVERT = 254
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPROTO_DONE = 257
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_HIFIRSTAUTO = 49152
+IPPORT_HILASTAUTO = 65535
+IPPORT_RESERVEDSTART = 600
+def IN_CLASSA(i): return (((u_int32_t)(i) & 0x80000000) == 0)
+
+IN_CLASSA_NET = 0xff000000
+IN_CLASSA_NSHIFT = 24
+IN_CLASSA_HOST = 0x00ffffff
+IN_CLASSA_MAX = 128
+def IN_CLASSB(i): return (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
+
+IN_CLASSB_NET = 0xffff0000
+IN_CLASSB_NSHIFT = 16
+IN_CLASSB_HOST = 0x0000ffff
+IN_CLASSB_MAX = 65536
+def IN_CLASSC(i): return (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
+
+IN_CLASSC_NET = 0xffffff00
+IN_CLASSC_NSHIFT = 8
+IN_CLASSC_HOST = 0x000000ff
+def IN_CLASSD(i): return (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
+
+def IN_BADCLASS(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_NONE = 0xffffffff
+IN_LOOPBACKNET = 127
+INET_ADDRSTRLEN = 16
+IP_OPTIONS = 1
+IP_HDRINCL = 2
+IP_TOS = 3
+IP_TTL = 4
+IP_RECVOPTS = 5
+IP_RECVRETOPTS = 6
+IP_RECVDSTADDR = 7
+IP_RETOPTS = 8
+IP_MULTICAST_IF = 9
+IP_MULTICAST_TTL = 10
+IP_MULTICAST_LOOP = 11
+IP_ADD_MEMBERSHIP = 12
+IP_DROP_MEMBERSHIP = 13
+IP_MULTICAST_VIF = 14
+IP_RSVP_ON = 15
+IP_RSVP_OFF = 16
+IP_RSVP_VIF_ON = 17
+IP_RSVP_VIF_OFF = 18
+IP_PORTRANGE = 19
+IP_RECVIF = 20
+IP_IPSEC_POLICY = 21
+IP_FAITH = 22
+IP_FW_ADD = 50
+IP_FW_DEL = 51
+IP_FW_FLUSH = 52
+IP_FW_ZERO = 53
+IP_FW_GET = 54
+IP_FW_RESETLOG = 55
+IP_DUMMYNET_CONFIGURE = 60
+IP_DUMMYNET_DEL = 61
+IP_DUMMYNET_FLUSH = 62
+IP_DUMMYNET_GET = 64
+IP_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
+IP_PORTRANGE_DEFAULT = 0
+IP_PORTRANGE_HIGH = 1
+IP_PORTRANGE_LOW = 2
+IPPROTO_MAXID = (IPPROTO_AH + 1)
+IPCTL_FORWARDING = 1
+IPCTL_SENDREDIRECTS = 2
+IPCTL_DEFTTL = 3
+IPCTL_DEFMTU = 4
+IPCTL_RTEXPIRE = 5
+IPCTL_RTMINEXPIRE = 6
+IPCTL_RTMAXCACHE = 7
+IPCTL_SOURCEROUTE = 8
+IPCTL_DIRECTEDBROADCAST = 9
+IPCTL_INTRQMAXLEN = 10
+IPCTL_INTRQDROPS = 11
+IPCTL_STATS = 12
+IPCTL_ACCEPTSOURCEROUTE = 13
+IPCTL_FASTFORWARDING = 14
+IPCTL_KEEPFAITH = 15
+IPCTL_GIF_TTL = 16
+IPCTL_MAXID = 17
+
+# Included from netinet6/in6.h
+
+# Included from sys/queue.h
+def SLIST_HEAD_INITIALIZER(head): return \
+
+def SLIST_ENTRY(type): return \
+
+def STAILQ_HEAD_INITIALIZER(head): return \
+
+def STAILQ_ENTRY(type): return \
+
+def LIST_HEAD_INITIALIZER(head): return \
+
+def LIST_ENTRY(type): return \
+
+def TAILQ_HEAD_INITIALIZER(head): return \
+
+def TAILQ_ENTRY(type): return \
+
+def CIRCLEQ_ENTRY(type): return \
+
+__KAME_VERSION = "20000701/FreeBSD-current"
+IPV6PORT_RESERVED = 1024
+IPV6PORT_ANONMIN = 49152
+IPV6PORT_ANONMAX = 65535
+IPV6PORT_RESERVEDMIN = 600
+IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1)
+INET6_ADDRSTRLEN = 46
+IPV6_ADDR_INT32_ONE = 1
+IPV6_ADDR_INT32_TWO = 2
+IPV6_ADDR_INT32_MNL = 0xff010000
+IPV6_ADDR_INT32_MLL = 0xff020000
+IPV6_ADDR_INT32_SMP = 0x0000ffff
+IPV6_ADDR_INT16_ULL = 0xfe80
+IPV6_ADDR_INT16_USL = 0xfec0
+IPV6_ADDR_INT16_MLL = 0xff02
+IPV6_ADDR_INT32_ONE = 0x01000000
+IPV6_ADDR_INT32_TWO = 0x02000000
+IPV6_ADDR_INT32_MNL = 0x000001ff
+IPV6_ADDR_INT32_MLL = 0x000002ff
+IPV6_ADDR_INT32_SMP = 0xffff0000
+IPV6_ADDR_INT16_ULL = 0x80fe
+IPV6_ADDR_INT16_USL = 0xc0fe
+IPV6_ADDR_INT16_MLL = 0x02ff
+def IN6_IS_ADDR_UNSPECIFIED(a): return \
+
+def IN6_IS_ADDR_LOOPBACK(a): return \
+
+def IN6_IS_ADDR_V4COMPAT(a): return \
+
+def IN6_IS_ADDR_V4MAPPED(a): return \
+
+IPV6_ADDR_SCOPE_NODELOCAL = 0x01
+IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
+IPV6_ADDR_SCOPE_SITELOCAL = 0x05
+IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
+IPV6_ADDR_SCOPE_GLOBAL = 0x0e
+__IPV6_ADDR_SCOPE_NODELOCAL = 0x01
+__IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
+__IPV6_ADDR_SCOPE_SITELOCAL = 0x05
+__IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
+__IPV6_ADDR_SCOPE_GLOBAL = 0x0e
+def IN6_IS_ADDR_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_GLOBAL(a): return \
+
+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
+
+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
+
+def IN6_IS_ADDR_MC_GLOBAL(a): return \
+
+def IN6_IS_SCOPE_LINKLOCAL(a): return \
+
+IPV6_OPTIONS = 1
+IPV6_RECVOPTS = 5
+IPV6_RECVRETOPTS = 6
+IPV6_RECVDSTADDR = 7
+IPV6_RETOPTS = 8
+IPV6_SOCKOPT_RESERVED1 = 3
+IPV6_UNICAST_HOPS = 4
+IPV6_MULTICAST_IF = 9
+IPV6_MULTICAST_HOPS = 10
+IPV6_MULTICAST_LOOP = 11
+IPV6_JOIN_GROUP = 12
+IPV6_LEAVE_GROUP = 13
+IPV6_PORTRANGE = 14
+ICMP6_FILTER = 18
+IPV6_PKTINFO = 19
+IPV6_HOPLIMIT = 20
+IPV6_NEXTHOP = 21
+IPV6_HOPOPTS = 22
+IPV6_DSTOPTS = 23
+IPV6_RTHDR = 24
+IPV6_PKTOPTIONS = 25
+IPV6_CHECKSUM = 26
+IPV6_BINDV6ONLY = 27
+IPV6_IPSEC_POLICY = 28
+IPV6_FAITH = 29
+IPV6_FW_ADD = 30
+IPV6_FW_DEL = 31
+IPV6_FW_FLUSH = 32
+IPV6_FW_ZERO = 33
+IPV6_FW_GET = 34
+IPV6_RTHDR_LOOSE = 0
+IPV6_RTHDR_STRICT = 1
+IPV6_RTHDR_TYPE_0 = 0
+IPV6_DEFAULT_MULTICAST_HOPS = 1
+IPV6_DEFAULT_MULTICAST_LOOP = 1
+IPV6_PORTRANGE_DEFAULT = 0
+IPV6_PORTRANGE_HIGH = 1
+IPV6_PORTRANGE_LOW = 2
+IPV6PROTO_MAXID = (IPPROTO_PIM + 1)
+IPV6CTL_FORWARDING = 1
+IPV6CTL_SENDREDIRECTS = 2
+IPV6CTL_DEFHLIM = 3
+IPV6CTL_DEFMTU = 4
+IPV6CTL_FORWSRCRT = 5
+IPV6CTL_STATS = 6
+IPV6CTL_MRTSTATS = 7
+IPV6CTL_MRTPROTO = 8
+IPV6CTL_MAXFRAGPACKETS = 9
+IPV6CTL_SOURCECHECK = 10
+IPV6CTL_SOURCECHECK_LOGINT = 11
+IPV6CTL_ACCEPT_RTADV = 12
+IPV6CTL_KEEPFAITH = 13
+IPV6CTL_LOG_INTERVAL = 14
+IPV6CTL_HDRNESTLIMIT = 15
+IPV6CTL_DAD_COUNT = 16
+IPV6CTL_AUTO_FLOWLABEL = 17
+IPV6CTL_DEFMCASTHLIM = 18
+IPV6CTL_GIF_HLIM = 19
+IPV6CTL_KAME_VERSION = 20
+IPV6CTL_USE_DEPRECATED = 21
+IPV6CTL_RR_PRUNE = 22
+IPV6CTL_MAPPED_ADDR = 23
+IPV6CTL_BINDV6ONLY = 24
+IPV6CTL_RTEXPIRE = 25
+IPV6CTL_RTMINEXPIRE = 26
+IPV6CTL_RTMAXCACHE = 27
+IPV6CTL_MAXID = 28
diff --git a/Lib/plat-freebsd5/SOCKET.py b/Lib/plat-freebsd5/SOCKET.py
new file mode 100644
index 0000000..6c6f34a
--- /dev/null
+++ b/Lib/plat-freebsd5/SOCKET.py
@@ -0,0 +1,142 @@
+# Generated by h2py from /usr/include/sys/socket.h
+SOCK_STREAM = 1
+SOCK_DGRAM = 2
+SOCK_RAW = 3
+SOCK_RDM = 4
+SOCK_SEQPACKET = 5
+SO_DEBUG = 0x0001
+SO_ACCEPTCONN = 0x0002
+SO_REUSEADDR = 0x0004
+SO_KEEPALIVE = 0x0008
+SO_DONTROUTE = 0x0010
+SO_BROADCAST = 0x0020
+SO_USELOOPBACK = 0x0040
+SO_LINGER = 0x0080
+SO_OOBINLINE = 0x0100
+SO_REUSEPORT = 0x0200
+SO_TIMESTAMP = 0x0400
+SO_ACCEPTFILTER = 0x1000
+SO_SNDBUF = 0x1001
+SO_RCVBUF = 0x1002
+SO_SNDLOWAT = 0x1003
+SO_RCVLOWAT = 0x1004
+SO_SNDTIMEO = 0x1005
+SO_RCVTIMEO = 0x1006
+SO_ERROR = 0x1007
+SO_TYPE = 0x1008
+SOL_SOCKET = 0xffff
+AF_UNSPEC = 0
+AF_LOCAL = 1
+AF_UNIX = AF_LOCAL
+AF_INET = 2
+AF_IMPLINK = 3
+AF_PUP = 4
+AF_CHAOS = 5
+AF_NS = 6
+AF_ISO = 7
+AF_OSI = AF_ISO
+AF_ECMA = 8
+AF_DATAKIT = 9
+AF_CCITT = 10
+AF_SNA = 11
+AF_DECnet = 12
+AF_DLI = 13
+AF_LAT = 14
+AF_HYLINK = 15
+AF_APPLETALK = 16
+AF_ROUTE = 17
+AF_LINK = 18
+pseudo_AF_XTP = 19
+AF_COIP = 20
+AF_CNT = 21
+pseudo_AF_RTIP = 22
+AF_IPX = 23
+AF_SIP = 24
+pseudo_AF_PIP = 25
+AF_ISDN = 26
+AF_E164 = AF_ISDN
+pseudo_AF_KEY = 27
+AF_INET6 = 28
+AF_NATM = 29
+AF_ATM = 30
+pseudo_AF_HDRCMPLT = 31
+AF_NETGRAPH = 32
+AF_MAX = 33
+SOCK_MAXADDRLEN = 255
+_SS_MAXSIZE = 128
+PF_UNSPEC = AF_UNSPEC
+PF_LOCAL = AF_LOCAL
+PF_UNIX = PF_LOCAL
+PF_INET = AF_INET
+PF_IMPLINK = AF_IMPLINK
+PF_PUP = AF_PUP
+PF_CHAOS = AF_CHAOS
+PF_NS = AF_NS
+PF_ISO = AF_ISO
+PF_OSI = AF_ISO
+PF_ECMA = AF_ECMA
+PF_DATAKIT = AF_DATAKIT
+PF_CCITT = AF_CCITT
+PF_SNA = AF_SNA
+PF_DECnet = AF_DECnet
+PF_DLI = AF_DLI
+PF_LAT = AF_LAT
+PF_HYLINK = AF_HYLINK
+PF_APPLETALK = AF_APPLETALK
+PF_ROUTE = AF_ROUTE
+PF_LINK = AF_LINK
+PF_XTP = pseudo_AF_XTP
+PF_COIP = AF_COIP
+PF_CNT = AF_CNT
+PF_SIP = AF_SIP
+PF_IPX = AF_IPX
+PF_RTIP = pseudo_AF_RTIP
+PF_PIP = pseudo_AF_PIP
+PF_ISDN = AF_ISDN
+PF_KEY = pseudo_AF_KEY
+PF_INET6 = AF_INET6
+PF_NATM = AF_NATM
+PF_ATM = AF_ATM
+PF_NETGRAPH = AF_NETGRAPH
+PF_MAX = AF_MAX
+NET_MAXID = AF_MAX
+NET_RT_DUMP = 1
+NET_RT_FLAGS = 2
+NET_RT_IFLIST = 3
+NET_RT_MAXID = 4
+SOMAXCONN = 128
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_DONTWAIT = 0x80
+MSG_EOF = 0x100
+MSG_COMPAT = 0x8000
+CMGROUP_MAX = 16
+SCM_RIGHTS = 0x01
+SCM_TIMESTAMP = 0x02
+SCM_CREDS = 0x03
+SHUT_RD = 0
+SHUT_WR = 1
+SHUT_RDWR = 2
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
diff --git a/Lib/plat-freebsd5/TERMIOS.py b/Lib/plat-freebsd5/TERMIOS.py
new file mode 100644
index 0000000..783c617
--- /dev/null
+++ b/Lib/plat-freebsd5/TERMIOS.py
@@ -0,0 +1,198 @@
+# Generated by h2py from /usr/include/termios.h
+VEOF = 0
+VEOL = 1
+VEOL2 = 2
+VERASE = 3
+VWERASE = 4
+VKILL = 5
+VREPRINT = 6
+VINTR = 8
+VQUIT = 9
+VSUSP = 10
+VDSUSP = 11
+VSTART = 12
+VSTOP = 13
+VLNEXT = 14
+VDISCARD = 15
+VMIN = 16
+VTIME = 17
+VSTATUS = 18
+NCCS = 20
+_POSIX_VDISABLE = 0xff
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IXANY = 0x00000800
+IMAXBEL = 0x00002000
+OPOST = 0x00000001
+ONLCR = 0x00000002
+OXTABS = 0x00000004
+ONOEOT = 0x00000008
+CIGNORE = 0x00000001
+CSIZE = 0x00000300
+CS5 = 0x00000000
+CS6 = 0x00000100
+CS7 = 0x00000200
+CS8 = 0x00000300
+CSTOPB = 0x00000400
+CREAD = 0x00000800
+PARENB = 0x00001000
+PARODD = 0x00002000
+HUPCL = 0x00004000
+CLOCAL = 0x00008000
+CCTS_OFLOW = 0x00010000
+CRTS_IFLOW = 0x00020000
+CDTR_IFLOW = 0x00040000
+CDSR_OFLOW = 0x00080000
+CCAR_OFLOW = 0x00100000
+MDMBUF = 0x00100000
+ECHOKE = 0x00000001
+ECHOE = 0x00000002
+ECHOK = 0x00000004
+ECHO = 0x00000008
+ECHONL = 0x00000010
+ECHOPRT = 0x00000020
+ECHOCTL = 0x00000040
+ISIG = 0x00000080
+ICANON = 0x00000100
+ALTWERASE = 0x00000200
+IEXTEN = 0x00000400
+EXTPROC = 0x00000800
+TOSTOP = 0x00400000
+FLUSHO = 0x00800000
+NOKERNINFO = 0x02000000
+PENDIN = 0x20000000
+NOFLSH = 0x80000000
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCSASOFT = 0x10
+B0 = 0
+B50 = 50
+B75 = 75
+B110 = 110
+B134 = 134
+B150 = 150
+B200 = 200
+B300 = 300
+B600 = 600
+B1200 = 1200
+B1800 = 1800
+B2400 = 2400
+B4800 = 4800
+B9600 = 9600
+B19200 = 19200
+B38400 = 38400
+B7200 = 7200
+B14400 = 14400
+B28800 = 28800
+B57600 = 57600
+B76800 = 76800
+B115200 = 115200
+B230400 = 230400
+EXTA = 19200
+EXTB = 38400
+TCIFLUSH = 1
+TCOFLUSH = 2
+TCIOFLUSH = 3
+TCOOFF = 1
+TCOON = 2
+TCIOFF = 3
+TCION = 4
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/ttycom.h
+
+# Included from sys/ioccom.h
+IOCPARM_MASK = 0x1fff
+def IOCPARM_LEN(x): return (((x) >> 16) & IOCPARM_MASK)
+
+def IOCBASECMD(x): return ((x) & ~(IOCPARM_MASK << 16))
+
+def IOCGROUP(x): return (((x) >> 8) & 0xff)
+
+IOC_VOID = 0x20000000
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+IOC_DIRMASK = 0xe0000000
+TIOCM_LE = 0001
+TIOCM_DTR = 0002
+TIOCM_RTS = 0004
+TIOCM_ST = 0010
+TIOCM_SR = 0020
+TIOCM_CTS = 0040
+TIOCM_CAR = 0100
+TIOCM_CD = TIOCM_CAR
+TIOCM_RNG = 0200
+TIOCM_RI = TIOCM_RNG
+TIOCM_DSR = 0400
+TIOCPKT_DATA = 0x00
+TIOCPKT_FLUSHREAD = 0x01
+TIOCPKT_FLUSHWRITE = 0x02
+TIOCPKT_STOP = 0x04
+TIOCPKT_START = 0x08
+TIOCPKT_NOSTOP = 0x10
+TIOCPKT_DOSTOP = 0x20
+TIOCPKT_IOCTL = 0x40
+def UIOCCMD(n): return _IO(ord('u'), n)
+
+TTYDISC = 0
+SLIPDISC = 4
+PPPDISC = 5
+NETGRAPHDISC = 6
+
+# Included from sys/ttydefaults.h
+TTYDEF_IFLAG = (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+TTYDEF_OFLAG = (OPOST | ONLCR)
+TTYDEF_LFLAG = (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+TTYDEF_CFLAG = (CREAD | CS8 | HUPCL)
+TTYDEF_SPEED = (B9600)
+def CTRL(x): return (x&037)
+
+CEOF = CTRL(ord('d'))
+CEOL = 0xff
+CERASE = 0177
+CINTR = CTRL(ord('c'))
+CSTATUS = CTRL(ord('t'))
+CKILL = CTRL(ord('u'))
+CMIN = 1
+CQUIT = 034
+CSUSP = CTRL(ord('z'))
+CTIME = 0
+CDSUSP = CTRL(ord('y'))
+CSTART = CTRL(ord('q'))
+CSTOP = CTRL(ord('s'))
+CLNEXT = CTRL(ord('v'))
+CDISCARD = CTRL(ord('o'))
+CWERASE = CTRL(ord('w'))
+CREPRINT = CTRL(ord('r'))
+CEOT = CEOF
+CBRK = CEOL
+CRPRNT = CREPRINT
+CFLUSH = CDISCARD
diff --git a/Lib/plat-freebsd5/regen b/Lib/plat-freebsd5/regen
new file mode 100644
index 0000000..5c502c2
--- /dev/null
+++ b/Lib/plat-freebsd5/regen
@@ -0,0 +1,6 @@
+#! /bin/sh
+set -v
+python ../../Tools/scripts/h2py.py /usr/include/fcntl.h
+python ../../Tools/scripts/h2py.py /usr/include/sys/socket.h
+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
+python ../../Tools/scripts/h2py.py /usr/include/termios.h