summaryrefslogtreecommitdiffstats
path: root/Lib/plat-unixware7/IN.py
blob: 3f97606751a656539558a8285bcbf6523860a83d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
# Generated by h2py from /usr/include/netinet/in.h

# Included from netinet/in_f.h
def IN_CLASSA(i): return (((long)(i) & 0x80000000) == 0)

IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 24
IN_CLASSA_HOST = 0x00ffffff
IN_CLASSA_MAX = 128
def IN_CLASSB(i): return (((long)(i) & 0xc0000000) == 0x80000000)

IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 16
IN_CLASSB_HOST = 0x0000ffff
IN_CLASSB_MAX = 65536
def IN_CLASSC(i): return (((long)(i) & 0xe0000000) == 0xc0000000)

IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 8
IN_CLASSC_HOST = 0x000000ff
def IN_CLASSD(i): return (((long)(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 (((long)(i) & 0xe0000000) == 0xe0000000)

def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)

INADDR_ANY = 0x00000000
INADDR_LOOPBACK = 0x7f000001
INADDR_BROADCAST = 0xffffffff
INADDR_NONE = 0xffffffff
IN_LOOPBACKNET = 127
INADDR_UNSPEC_GROUP = 0xe0000000
INADDR_ALLHOSTS_GROUP = 0xe0000001
INADDR_ALLRTRS_GROUP = 0xe0000002
INADDR_MAX_LOCAL_GROUP = 0xe00000ff

# Included from netinet/in6.h

# Included from sys/types.h
def quad_low(x): return x.val[0]

ADT_EMASKSIZE = 8
SHRT_MIN = -32768
SHRT_MAX = 32767
INT_MIN = (-2147483647-1)
INT_MAX = 2147483647
LONG_MIN = (-2147483647-1)
LONG_MAX = 2147483647
OFF32_MAX = LONG_MAX
ISTAT_ASSERTED = 0
ISTAT_ASSUMED = 1
ISTAT_NONE = 2
OFF_MAX = OFF32_MAX
CLOCK_MAX = LONG_MAX
P_MYID = (-1)
P_MYHOSTID = (-1)

# Included from sys/select.h
FD_SETSIZE = 4096
NBBY = 8
NULL = 0

# Included from sys/bitypes.h

# Included from netinet/in6_f.h
def IN6_IS_ADDR_UNSPECIFIED(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0)

def IN6_SET_ADDR_UNSPECIFIED(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0)

def IN6_IS_ADDR_ANY(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0)

def IN6_SET_ADDR_ANY(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0)

def IN6_IS_ADDR_LOOPBACK(a): return IN6_ADDR_EQUAL_L(a, 0, 0, 0, 0x01000000)

def IN6_SET_ADDR_LOOPBACK(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0x01000000)

IN6_MC_FLAG_PERMANENT = 0x0
IN6_MC_FLAG_TRANSIENT = 0x1
IN6_MC_SCOPE_NODELOCAL = 0x1
IN6_MC_SCOPE_LINKLOCAL = 0x2
IN6_MC_SCOPE_SITELOCAL = 0x5
IN6_MC_SCOPE_ORGLOCAL = 0x8
IN6_MC_SCOPE_GLOBAL = 0xE
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 \


# Included from sys/convsa.h
__NETLIB_UW211_SVR4 = 1
__NETLIB_UW211_XPG4 = 2
__NETLIB_GEMINI_SVR4 = 3
__NETLIB_GEMINI_XPG4 = 4
__NETLIB_FP1_SVR4 = 5
__NETLIB_FP1_XPG4 = 6
__NETLIB_BASE_VERSION__ = __NETLIB_UW211_SVR4
__NETLIB_VERSION__ = __NETLIB_FP1_SVR4
__NETLIB_VERSION__ = __NETLIB_FP1_XPG4
__NETLIB_VERSION__ = __NETLIB_GEMINI_SVR4
__NETLIB_VERSION__ = __NETLIB_GEMINI_XPG4
__NETLIB_VERSION__ = __NETLIB_UW211_SVR4
__NETLIB_VERSION__ = __NETLIB_UW211_XPG4
__NETLIB_VERSION__ = __NETLIB_FP1_XPG4

# Included from sys/byteorder.h
LITTLE_ENDIAN = 1234
BIG_ENDIAN = 4321
PDP_ENDIAN = 3412

# Included from sys/byteorder_f.h
BYTE_ORDER = LITTLE_ENDIAN
def htonl(hl): return __htonl(hl)

def ntohl(nl): return __ntohl(nl)

def htons(hs): return __htons(hs)

def ntohs(ns): return __ntohs(ns)

def ntohl(x): return (x)

def ntohs(x): return (x)

def htonl(x): return (x)

def htons(x): return (x)

def __NETLIB_VERSION_IS_XPG4(version): return (((version) % 2) == 0)

def __NETLIB_VERSION_HAS_SALEN(version): return ((version) >= __NETLIB_GEMINI_SVR4)

def __NETLIB_VERSION_IS_IKS(version): return ((version) >= __NETLIB_FP1_SVR4)

def SA_FAMILY_GET(sa): return \

INET6_ADDRSTRLEN = 46
IPV6_UNICAST_HOPS = 3
IPV6_ADDRFORM = 24
IPV6_MULTICAST_HOPS = 25
IPV6_MULTICAST_IF = 26
IPV6_MULTICAST_LOOP = 27
IPV6_ADD_MEMBERSHIP = 28
IPV6_DROP_MEMBERSHIP = 29

# Included from sys/insrem.h
def LIST_INIT(head): return \

def LIST_INIT(head): return \

def remque(a): return REMQUE(a)


# Included from sys/socket.h

# Included from sys/uio.h
SHUT_RD = 0
SHUT_WR = 1
SHUT_RDWR = 2

# Included from sys/netconfig.h

# Included from sys/cdefs.h
def __P(protos): return protos		 

def __STRING(x): return #x

def __P(protos): return ()		 

def __STRING(x): return "x"

NETCONFIG = "/etc/netconfig"
NETPATH = "NETPATH"
NC_TPI_CLTS = 1
NC_TPI_COTS = 2
NC_TPI_COTS_ORD = 3
NC_TPI_RAW = 4
NC_NOFLAG = 00
NC_VISIBLE = 01
NC_BROADCAST = 02
NC_NOPROTOFMLY = "-"
NC_LOOPBACK = "loopback"
NC_INET = "inet"
NC_INET6 = "inet6"
NC_IMPLINK = "implink"
NC_PUP = "pup"
NC_CHAOS = "chaos"
NC_NS = "ns"
NC_NBS = "nbs"
NC_ECMA = "ecma"
NC_DATAKIT = "datakit"
NC_CCITT = "ccitt"
NC_SNA = "sna"
NC_DECNET = "decnet"
NC_DLI = "dli"
NC_LAT = "lat"
NC_HYLINK = "hylink"
NC_APPLETALK = "appletalk"
NC_NIT = "nit"
NC_IEEE802 = "ieee802"
NC_OSI = "osi"
NC_X25 = "x25"
NC_OSINET = "osinet"
NC_GOSIP = "gosip"
NC_NETWARE = "netware"
NC_NOPROTO = "-"
NC_TCP = "tcp"
NC_UDP = "udp"
NC_ICMP = "icmp"
NC_IPX = "ipx"
NC_SPX = "spx"
NC_TPI_CLTS = 1
NC_TPI_COTS = 2
NC_TPI_COTS_ORD = 3
NC_TPI_RAW = 4
SOCK_STREAM = 2
SOCK_DGRAM = 1
SOCK_RAW = 4
SOCK_RDM = 5
SOCK_SEQPACKET = 6
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_ORDREL = 0x0200
SO_IMASOCKET = 0x0400
SO_MGMT = 0x0800
SO_REUSEPORT = 0x1000
SO_LISTENING = 0x2000
SO_RDWR = 0x4000
SO_SEMA = 0x8000
SO_DONTLINGER = (~SO_LINGER)
SO_SNDBUF = 0x1001
SO_RCVBUF = 0x1002
SO_SNDLOWAT = 0x1003
SO_RCVLOWAT = 0x1004
SO_SNDTIMEO = 0x1005
SO_RCVTIMEO = 0x1006
SO_ERROR = 0x1007
SO_TYPE = 0x1008
SO_PROTOTYPE = 0x1009
SO_ALLRAW = 0x100a
SOL_SOCKET = 0xffff
AF_UNSPEC = 0
AF_UNIX = 1
AF_LOCAL = AF_UNIX
AF_INET = 2
AF_IMPLINK = 3
AF_PUP = 4
AF_CHAOS = 5
AF_NS = 6
AF_NBS = 7
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_NIT = 17
AF_802 = 18
AF_OSI = 19
AF_ISO = AF_OSI
AF_X25 = 20
AF_OSINET = 21
AF_GOSIP = 22
AF_YNET = 23
AF_ROUTE = 24
AF_LINK = 25
pseudo_AF_XTP = 26
AF_INET6 = 27
AF_MAX = 27
AF_INET_BSWAP = 0x0200
PF_UNSPEC = AF_UNSPEC
PF_UNIX = AF_UNIX
PF_LOCAL = AF_LOCAL
PF_INET = AF_INET
PF_IMPLINK = AF_IMPLINK
PF_PUP = AF_PUP
PF_CHAOS = AF_CHAOS
PF_NS = AF_NS
PF_NBS = AF_NBS
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_NIT = AF_NIT
PF_802 = AF_802
PF_OSI = AF_OSI
PF_ISO = PF_OSI
PF_X25 = AF_X25
PF_OSINET = AF_OSINET
PF_GOSIP = AF_GOSIP
PF_YNET = AF_YNET
PF_ROUTE = AF_ROUTE
PF_LINK = AF_LINK
pseudo_PF_XTP = pseudo_AF_XTP
PF_INET6 = AF_INET6
PF_MAX = AF_MAX
SOMAXCONN = 5
SCM_RIGHTS = 1
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_DONTROUTE = 0x4
MSG_CTRUNC = 0x8
MSG_TRUNC = 0x10
MSG_EOR = 0x30
MSG_WAITALL = 0x20
MSG_MAXIOVLEN = 16
def OPTLEN(x): return ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))

GIARG = 0x1
CONTI = 0x2
GITAB = 0x4
SOCKETSYS = 88
SOCKETSYS = 83
SO_ACCEPT = 1
SO_BIND = 2
SO_CONNECT = 3
SO_GETPEERNAME = 4
SO_GETSOCKNAME = 5
SO_GETSOCKOPT = 6
SO_LISTEN = 7
SO_RECV = 8
SO_RECVFROM = 9
SO_SEND = 10
SO_SENDTO = 11
SO_SETSOCKOPT = 12
SO_SHUTDOWN = 13
SO_SOCKET = 14
SO_SOCKPOLL = 15
SO_GETIPDOMAIN = 16
SO_SETIPDOMAIN = 17
SO_ADJTIME = 18

# Included from sys/stream.h

# Included from sys/cred.h

# Included from sys/ksynch.h

# Included from sys/dl.h
SIGNBIT = 0x80000000

# Included from sys/ipl.h

# Included from sys/disp_p.h

# Included from sys/trap.h
DIVERR = 0
SGLSTP = 1
NMIFLT = 2
BPTFLT = 3
INTOFLT = 4
BOUNDFLT = 5
INVOPFLT = 6
NOEXTFLT = 7
DBLFLT = 8
EXTOVRFLT = 9
INVTSSFLT = 10
SEGNPFLT = 11
STKFLT = 12
GPFLT = 13
PGFLT = 14
EXTERRFLT = 16
ALIGNFLT = 17
MCEFLT = 18
USERFLT = 0x100
TRP_PREEMPT = 0x200
TRP_UNUSED = 0x201
PF_ERR_MASK = 0x01
PF_ERR_PAGE = 0
PF_ERR_PROT = 1
PF_ERR_WRITE = 2
PF_ERR_USER = 4
EVT_STRSCHED = 0x04
EVT_GLOBCALLOUT = 0x08
EVT_LCLCALLOUT = 0x10
EVT_SOFTINTMASK = (EVT_STRSCHED|EVT_GLOBCALLOUT|EVT_LCLCALLOUT)
PL0 = 0
PL1 = 1
PL2 = 2
PL3 = 3
PL4 = 4
PL5 = 5
PL6 = 6
PLHI = 8
PL7 = PLHI
PLBASE = PL0
PLTIMEOUT = PL1
PLDISK = PL5
PLSTR = PL6
PLTTY = PLSTR
PLMIN = PL0
PLMIN = PL1
MAX_INTR_LEVELS = 10
MAX_INTR_NESTING = 50
STRSCHED = EVT_STRSCHED
GLOBALSOFTINT = EVT_GLOBCALLOUT
LOCALSOFTINT = EVT_LCLCALLOUT

# Included from sys/ksynch_p.h
def GET_TIME(timep): return \

LK_THRESHOLD = 500000

# Included from sys/list.h

# Included from sys/listasm.h
def remque_null(e): return \

def LS_ISEMPTY(listp): return \

LK_BASIC = 0x1
LK_SLEEP = 0x2
LK_NOSTATS = 0x4
def CYCLES_SINCE(c): return CYCLES_BETWEEN((c), CYCLES())

LSB_NLKDS = 92
EVT_RUNRUN = 0x01
EVT_KPRUNRUN = 0x02
SP_UNLOCKED = 0
SP_LOCKED = 1
KS_LOCKTEST = 0x01
KS_MPSTATS = 0x02
KS_DEINITED = 0x04
KS_NVLTTRACE = 0x08
RWS_READ = (ord('r'))
RWS_WRITE = (ord('w'))
RWS_UNLOCKED = (ord('u'))
RWS_BUSY = (ord('b'))
def SLEEP_LOCKOWNED(lkp): return \

def SLEEP_DISOWN(lkp): return \

KS_NOPRMPT = 0x00000001
__KS_LOCKTEST = KS_LOCKTEST
__KS_LOCKTEST = 0
__KS_MPSTATS = KS_MPSTATS
__KS_MPSTATS = 0
__KS_NVLTTRACE = KS_NVLTTRACE
__KS_NVLTTRACE = 0
KSFLAGS = (__KS_LOCKTEST|__KS_MPSTATS|__KS_NVLTTRACE)
KSVUNIPROC = 1
KSVMPDEBUG = 2
KSVMPNODEBUG = 3
KSVFLAG = KSVUNIPROC
KSVFLAG = KSVMPDEBUG
KSVFLAG = KSVMPNODEBUG

# Included from sys/ksinline.h
_A_SP_LOCKED = 1
_A_SP_UNLOCKED = 0
_A_INVPL = -1
def _ATOMIC_INT_INCR(atomic_intp): return \

def _ATOMIC_INT_DECR(atomic_intp): return \

def ATOMIC_INT_READ(atomic_intp): return _ATOMIC_INT_READ(atomic_intp)

def ATOMIC_INT_INCR(atomic_intp): return _ATOMIC_INT_INCR(atomic_intp)

def ATOMIC_INT_DECR(atomic_intp): return _ATOMIC_INT_DECR(atomic_intp)

def FSPIN_INIT(lp): return  

def FSPIN_LOCK(l): return DISABLE()

def FSPIN_TRYLOCK(l): return (DISABLE(), B_TRUE)

def FSPIN_UNLOCK(l): return ENABLE()

def LOCK_DEINIT(lp): return  

def LOCK_DEALLOC(lp): return  

def LOCK_OWNED(lp): return (B_TRUE)

def RW_DEINIT(lp): return  

def RW_DEALLOC(lp): return  

def RW_OWNED(lp): return (B_TRUE)

def IS_LOCKED(lockp): return B_FALSE

def LOCK_PLMIN(lockp): return \

def TRYLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp)

def LOCK_SH_PLMIN(lockp): return LOCK_PLMIN(lockp)

def RW_RDLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp)

def RW_WRLOCK_PLMIN(lockp): return LOCK_PLMIN(lockp)

def LOCK_DEINIT(l): return  

def LOCK_PLMIN(lockp): return LOCK((lockp), PLMIN)

def TRYLOCK_PLMIN(lockp): return TRYLOCK((lockp), PLMIN)

def LOCK_SH_PLMIN(lockp): return LOCK_SH((lockp), PLMIN)

def RW_RDLOCK_PLMIN(lockp): return RW_RDLOCK((lockp), PLMIN)

def RW_WRLOCK_PLMIN(lockp): return RW_WRLOCK((lockp), PLMIN)

def FSPIN_IS_LOCKED(fsp): return B_FALSE

def SPIN_IS_LOCKED(lockp): return B_FALSE

def FSPIN_OWNED(l): return (B_TRUE)

CR_MLDREAL = 0x00000001
CR_RDUMP = 0x00000002
def crhold(credp): return crholdn((credp), 1)	 

def crfree(credp): return crfreen((credp), 1)	 


# Included from sys/strmdep.h
def str_aligned(X): return (((uint)(X) & (sizeof(int) - 1)) == 0)


# Included from sys/engine.h

# Included from sys/clock.h

# Included from sys/time.h
DST_NONE = 0
DST_USA = 1
DST_AUST = 2
DST_WET = 3
DST_MET = 4
DST_EET = 5
DST_CAN = 6
DST_GB = 7
DST_RUM = 8
DST_TUR = 9
DST_AUSTALT = 10
ITIMER_REAL = 0
ITIMER_VIRTUAL = 1
ITIMER_PROF = 2
FD_SETSIZE = 4096
FD_NBBY = 8

# Included from time.h
NULL = 0
CLOCKS_PER_SEC = 1000000

# Included from sys/clock_p.h
CGBITS = 4
IDBITS = 28
def toid_unpackcg(idval): return (((idval) >> IDBITS) & 0xf)

def toid_unpackid(idval): return ((idval) & 0xfffffff)

def toid_unpackcg(idval): return 0

def toid_unpackid(idval): return (idval)

NCALLOUT_HASH = 1024
CALLOUT_MAXVAL = 0x7fffffff
TO_PERIODIC = 0x80000000
TO_IMMEDIATE = 0x80000000
SEC = 1
MILLISEC = 1000
MICROSEC = 1000000
NANOSEC = 1000000000
SECHR = (60*60)
SECDAY = (24*SECHR)
SECYR = (365*SECDAY)
def TIME_OWNED_R(cgnum): return (B_TRUE)

LOOPSECONDS = 1800
LOOPMICROSECONDS = (LOOPSECONDS * MICROSEC)
def TICKS_SINCE(t): return TICKS_BETWEEN(t, TICKS())

MAXRQS = 2
E_OFFLINE = 0x01
E_BAD = 0x02
E_SHUTDOWN = 0x04
E_DRIVER = 0x08
E_DEFAULTKEEP = 0x100
E_DRIVERBOUND = 0x200
E_EXCLUSIVE = 0x400
E_CGLEADER = 0x800
E_NOWAY = (E_OFFLINE|E_BAD|E_SHUTDOWN)
E_BOUND = 0x01
E_GLOBAL = 0x00
E_UNAVAIL = -1
ENGINE_ONLINE = 1
def PROCESSOR_UNMAP(e): return ((e) - engine)

BOOTENG = 0
QMOVED = 0x0001
QWANTR = 0x0002
QWANTW = 0x0004
QFULL = 0x0008
QREADR = 0x0010
QUSE = 0x0020
QNOENB = 0x0040
QUP = 0x0080
QBACK = 0x0100
QINTER = 0x0200
QPROCSON = 0x0400
QTOENAB = 0x0800
QFREEZE = 0x1000
QBOUND = 0x2000
QDEFCNT = 0x4000
QENAB = 0x0001
QSVCBUSY = 0x0002
STRM_PUTCNT_TABLES = 31
def STRM_MYENG_PUTCNT(sdp): return STRM_PUTCNT(l.eng_num, sdp)

QB_FULL = 0x01
QB_WANTW = 0x02
QB_BACK = 0x04
NBAND = 256
DB_WASDUPED = 0x1
DB_2PIECE = 0x2
STRLEAKHASHSZ = 1021
MSGMARK = 0x01
MSGNOLOOP = 0x02
MSGDELIM = 0x04
MSGNOGET = 0x08
MSGLOG = 0x10
M_DATA = 0x00
M_PROTO = 0x01
M_BREAK = 0x08
M_PASSFP = 0x09
M_SIG = 0x0b
M_DELAY = 0x0c
M_CTL = 0x0d
M_IOCTL = 0x0e
M_SETOPTS = 0x10
M_RSE = 0x11
M_TRAIL = 0x12
M_IOCACK = 0x81
M_IOCNAK = 0x82
M_PCPROTO = 0x83
M_PCSIG = 0x84
M_READ = 0x85
M_FLUSH = 0x86
M_STOP = 0x87
M_START = 0x88
M_HANGUP = 0x89
M_ERROR = 0x8a
M_COPYIN = 0x8b
M_COPYOUT = 0x8c
M_IOCDATA = 0x8d
M_PCRSE = 0x8e
M_STOPI = 0x8f
M_STARTI = 0x90
M_PCCTL = 0x91
M_PCSETOPTS = 0x92
QNORM = 0x00
QPCTL = 0x80
STRCANON = 0x01
RECOPY = 0x02
SO_ALL = 0x003f
SO_READOPT = 0x0001
SO_WROFF = 0x0002
SO_MINPSZ = 0x0004
SO_MAXPSZ = 0x0008
SO_HIWAT = 0x0010
SO_LOWAT = 0x0020
SO_MREADON = 0x0040
SO_MREADOFF = 0x0080
SO_NDELON = 0x0100
SO_NDELOFF = 0x0200
SO_ISTTY = 0x0400
SO_ISNTTY = 0x0800
SO_TOSTOP = 0x1000
SO_TONSTOP = 0x2000
SO_BAND = 0x4000
SO_DELIM = 0x8000
SO_NODELIM = 0x010000
SO_STRHOLD = 0x020000
SO_LOOP = 0x040000
DRVOPEN = 0x0
MODOPEN = 0x1
CLONEOPEN = 0x2
OPENFAIL = -1
BPRI_LO = 1
BPRI_MED = 2
BPRI_HI = 3
INFPSZ = -1
FLUSHALL = 1
FLUSHDATA = 0
STRHIGH = 5120
STRLOW = 1024
MAXIOCBSZ = 1024
def straln(a): return (caddr_t)((long)(a) & ~(sizeof(int)-1))

IPM_ID = 200
ICMPM_ID = 201
TCPM_ID = 202
UDPM_ID = 203
ARPM_ID = 204
APPM_ID = 205
RIPM_ID = 206
PPPM_ID = 207
AHDLCM_ID = 208
MHDLCRIPM_ID = 209
HDLCM_ID = 210
PPCID_ID = 211
IGMPM_ID = 212
IPIPM_ID = 213
IPPROTO_IP = 0
IPPROTO_HOPOPTS = 0
IPPROTO_ICMP = 1
IPPROTO_IGMP = 2
IPPROTO_GGP = 3
IPPROTO_IPIP = 4
IPPROTO_TCP = 6
IPPROTO_EGP = 8
IPPROTO_PUP = 12
IPPROTO_UDP = 17
IPPROTO_IDP = 22
IPPROTO_TP = 29
IPPROTO_IPV6 = 41
IPPROTO_ROUTING = 43
IPPROTO_FRAGMENT = 44
IPPROTO_ESP = 50
IPPROTO_AH = 51
IPPROTO_ICMPV6 = 58
IPPROTO_NONE = 59
IPPROTO_DSTOPTS = 60
IPPROTO_HELLO = 63
IPPROTO_ND = 77
IPPROTO_EON = 80
IPPROTO_RAW = 255
IPPROTO_MAX = 256
IPPORT_ECHO = 7
IPPORT_DISCARD = 9
IPPORT_SYSTAT = 11
IPPORT_DAYTIME = 13
IPPORT_NETSTAT = 15
IPPORT_FTP = 21
IPPORT_TELNET = 23
IPPORT_SMTP = 25
IPPORT_TIMESERVER = 37
IPPORT_NAMESERVER = 42
IPPORT_WHOIS = 43
IPPORT_MTP = 57
IPPORT_TFTP = 69
IPPORT_RJE = 77
IPPORT_FINGER = 79
IPPORT_TTYLINK = 87
IPPORT_SUPDUP = 95
IPPORT_EXECSERVER = 512
IPPORT_LOGINSERVER = 513
IPPORT_CMDSERVER = 514
IPPORT_EFSSERVER = 520
IPPORT_BIFFUDP = 512
IPPORT_WHOSERVER = 513
IPPORT_ROUTESERVER = 520
IPPORT_RESERVED = 1024
IPPORT_USERRESERVED = 65535
IPPORT_RESERVED_LOW = 512
IPPORT_RESERVED_HIGH = 1023
IPPORT_USERRESERVED_LOW = 32768
IPPORT_USERRESERVED_HIGH = 65535
INET_ADDRSTRLEN = 16
IP_OPTIONS = 1
IP_TOS = 2
IP_TTL = 3
IP_HDRINCL = 4
IP_RECVOPTS = 5
IP_RECVRETOPTS = 6
IP_RECVDSTADDR = 7
IP_RETOPTS = 8
IP_MULTICAST_IF = 9
IP_MULTICAST_LOOP = 10
IP_ADD_MEMBERSHIP = 11
IP_DROP_MEMBERSHIP = 12
IP_BROADCAST_IF = 14
IP_RECVIFINDEX = 15
IP_MULTICAST_TTL = 16
MRT_INIT = 17
MRT_DONE = 18
MRT_ADD_VIF = 19
MRT_DEL_VIF = 20
MRT_ADD_MFC = 21
MRT_DEL_MFC = 22
MRT_VERSION = 23
IP_DEFAULT_MULTICAST_TTL = 1
IP_DEFAULT_MULTICAST_LOOP = 1
IP_MAX_MEMBERSHIPS = 20
INADDR_UNSPEC_GROUP = 0xe0000000
INADDR_ALLHOSTS_GROUP = 0xe0000001
INADDR_ALLRTRS_GROUP = 0xe0000002
INADDR_MAX_LOCAL_GROUP = 0xe00000ff

# Included from netinet/in_mp.h

# Included from netinet/in_mp_ddi.h

# Included from sys/inline.h
IP_HIER_BASE = (20)
def ASSERT_LOCK(x): return  

def ASSERT_WRLOCK(x): return  

def ASSERT_UNLOCK(x): return  

def CANPUT(q): return canput((q))

def CANPUTNEXT(q): return canputnext((q))

INET_DEBUG = 1