xref: /xnu-10063.141.1/tools/lldbmacros/mbufdefines.py (revision d8b80295118ef25ac3a784134bcf95cd8e88109f)
1*d8b80295SApple OSS Distributionsfrom xnu import *
2*d8b80295SApple OSS Distributionsfrom utils import *
3*d8b80295SApple OSS Distributionsimport ctypes
4*d8b80295SApple OSS Distributions
5*d8b80295SApple OSS DistributionsMBSHIFT = 20
6*d8b80295SApple OSS DistributionsMSIZE = 256
7*d8b80295SApple OSS DistributionsMCLBYTES = 2048
8*d8b80295SApple OSS DistributionsMBIGCLBYTES = 4096
9*d8b80295SApple OSS DistributionsM16KCLBYTES = 16384
10*d8b80295SApple OSS Distributions
11*d8b80295SApple OSS DistributionsMB_INUSE = 1
12*d8b80295SApple OSS DistributionsMB_COMP_INUSE = 2
13*d8b80295SApple OSS DistributionsMB_SCVALID = 4
14*d8b80295SApple OSS Distributions
15*d8b80295SApple OSS DistributionsSLF_MAPPED = 0x0001
16*d8b80295SApple OSS DistributionsSLF_PARTIAL = 0x0002
17*d8b80295SApple OSS DistributionsSLF_DETACHED = 0x0004
18*d8b80295SApple OSS Distributions
19*d8b80295SApple OSS DistributionsINTP = ctypes.POINTER(ctypes.c_int)
20*d8b80295SApple OSS Distributions
21*d8b80295SApple OSS DistributionsMCF_NOCPUCACHE = 0x10
22*d8b80295SApple OSS Distributions
23*d8b80295SApple OSS Distributionsdef enum(*sequential, **named):
24*d8b80295SApple OSS Distributions    enums = dict(zip(sequential, range(len(sequential))), **named)
25*d8b80295SApple OSS Distributions    reverse = dict((value, key) for key, value in enums.items())
26*d8b80295SApple OSS Distributions    enums['reverse_mapping'] = reverse
27*d8b80295SApple OSS Distributions    return type('Enum', (), enums)
28*d8b80295SApple OSS Distributions
29*d8b80295SApple OSS DistributionsMbuf_Type = enum(
30*d8b80295SApple OSS Distributions    'MT_FREE',
31*d8b80295SApple OSS Distributions    'MT_DATA',
32*d8b80295SApple OSS Distributions    'MT_HEADER',
33*d8b80295SApple OSS Distributions    'MT_SOCKET',
34*d8b80295SApple OSS Distributions    'MT_PCB',
35*d8b80295SApple OSS Distributions    'MT_RTABLE',
36*d8b80295SApple OSS Distributions    'MT_HTABLE',
37*d8b80295SApple OSS Distributions    'MT_ATABLE',
38*d8b80295SApple OSS Distributions    'MT_SONAME',
39*d8b80295SApple OSS Distributions    'MT_SOOPTS',
40*d8b80295SApple OSS Distributions    'MT_FTABLE',
41*d8b80295SApple OSS Distributions    'MT_RIGHTS',
42*d8b80295SApple OSS Distributions    'MT_IFADDR',
43*d8b80295SApple OSS Distributions    'MT_CONTROL',
44*d8b80295SApple OSS Distributions    'MT_OOBDATA',
45*d8b80295SApple OSS Distributions    'MT_TAG',
46*d8b80295SApple OSS Distributions    'MT_LAST')
47*d8b80295SApple OSS Distributions
48*d8b80295SApple OSS DistributionsM_EXT           = 0x0001
49*d8b80295SApple OSS DistributionsM_PKTHDR        = 0x0002
50*d8b80295SApple OSS DistributionsM_EOR           = 0x0004
51*d8b80295SApple OSS DistributionsM_PROTO1        = 0x0008
52*d8b80295SApple OSS DistributionsM_PROTO2        = 0x0010
53*d8b80295SApple OSS DistributionsM_PROTO3        = 0x0020
54*d8b80295SApple OSS DistributionsM_LOOP          = 0x0040
55*d8b80295SApple OSS DistributionsM_PROTO5        = 0x0080
56*d8b80295SApple OSS Distributions
57*d8b80295SApple OSS DistributionsM_BCAST         = 0x0100
58*d8b80295SApple OSS DistributionsM_MCAST         = 0x0200
59*d8b80295SApple OSS DistributionsM_FRAG          = 0x0400
60*d8b80295SApple OSS DistributionsM_FIRSTFRAG     = 0x0800
61*d8b80295SApple OSS DistributionsM_LASTFRAG      = 0x1000
62*d8b80295SApple OSS DistributionsM_PROMISC       = 0x2000
63*d8b80295SApple OSS DistributionsM_HASFCS        = 0x4000
64*d8b80295SApple OSS DistributionsM_TAGHDR        = 0x8000
65*d8b80295SApple OSS Distributions
66*d8b80295SApple OSS Distributionsmbuf_flags_strings = [
67*d8b80295SApple OSS Distributions    "EXT",
68*d8b80295SApple OSS Distributions    "PKTHDR",
69*d8b80295SApple OSS Distributions    "EOR",
70*d8b80295SApple OSS Distributions    "PROTO1",
71*d8b80295SApple OSS Distributions    "PROTO2",
72*d8b80295SApple OSS Distributions    "PROTO3",
73*d8b80295SApple OSS Distributions    "LOOP",
74*d8b80295SApple OSS Distributions    "PROTO5",
75*d8b80295SApple OSS Distributions
76*d8b80295SApple OSS Distributions    "BCAST",
77*d8b80295SApple OSS Distributions    "MCAST",
78*d8b80295SApple OSS Distributions    "FRAG",
79*d8b80295SApple OSS Distributions    "FIRSTFRAG",
80*d8b80295SApple OSS Distributions    "LASTFRAG",
81*d8b80295SApple OSS Distributions    "PROMISC",
82*d8b80295SApple OSS Distributions    "HASFCS",
83*d8b80295SApple OSS Distributions    "TAGHDR"]
84*d8b80295SApple OSS Distributions
85*d8b80295SApple OSS Distributionsmbuf_pkt_crumb_strings = [
86*d8b80295SApple OSS Distributions    "TS_COMP_REQ",
87*d8b80295SApple OSS Distributions    "TS_COMP_CB",
88*d8b80295SApple OSS Distributions    "DLIL_OUTPUT",
89*d8b80295SApple OSS Distributions    "FLOW_TX",
90*d8b80295SApple OSS Distributions    "FQ_ENQUEUE",
91*d8b80295SApple OSS Distributions    "FQ_DEQUEUE",
92*d8b80295SApple OSS Distributions    "SK_PKT_COPY",
93*d8b80295SApple OSS Distributions    "TCP_OUTPUT",
94*d8b80295SApple OSS Distributions    "UDP_OUTPUT",
95*d8b80295SApple OSS Distributions    "SOSEND",
96*d8b80295SApple OSS Distributions    "DLIL_INPUT",
97*d8b80295SApple OSS Distributions    "IP_INPUT",
98*d8b80295SApple OSS Distributions    "TCP_INPUT",
99*d8b80295SApple OSS Distributions    "UDP_INPUT"]
100