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