-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinaddr.py
More file actions
68 lines (56 loc) · 1.72 KB
/
Copy pathinaddr.py
File metadata and controls
68 lines (56 loc) · 1.72 KB
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
"""++
Copyright (c) Microsoft Corporation
Module Name:
inaddr.h
Environment:
user mode or kernel mode
--"""
from . import cpreproc
if cpreproc.pragma_once("s_addr"):
from .minwindef import *
# REGION *** Desktop Family or OneCore Family or Games Family ***
#
# IPv4 Internet address
# This is an 'on-wire' format structure.
#
class in_addr(CStructure):
class CLS_S_un(Union):
class CLS_S_un_b(CStructure):
_fields_ = [
("s_b1", BYTE),
("s_b2", BYTE),
("s_b3", BYTE),
("s_b4", BYTE)
]
s_b1: int
s_b2: int
s_b3: int
s_b4: int
class CLS_S_un_w(CStructure):
_fields_ = [
("s_w1", USHORT),
("s_w2", USHORT)
]
s_w1: int
s_w2: int
_fields_ = [
("S_un_b", CLS_S_un_b),
("S_un_w", CLS_S_un_w),
("S_addr", ULONG)
]
S_un_b: CLS_S_un_b
S_un_w: CLS_S_un_w
S_addr: int
_fields_ = [
("S_un", CLS_S_un)
]
S_un: CLS_S_un
IN_ADDR = in_addr
PIN_ADDR = LPIN_ADDR = POINTER(IN_ADDR)
s_addr = lambda x: x.S_un.S_addr # can be used for most tcp & ip code
s_host = lambda x: x.S_un.S_un_b.s_b2 # host on imp
s_net = lambda x: x.S_un.S_un_b.s_b1 # network
s_imp = lambda x: x.S_un.S_un_w.s_w2 # imp
s_impno = lambda x: x.S_un.S_un_b.s_b4 # imp #
s_lh = lambda x: x.S_un.S_un_b.s_b3 # logical host
# REGION ***