Hex Artifact Content

Not logged in

Artifact 5ac570681356fed199c40e3010b533a976be61cf:


0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20  ********\..*    
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0060: 20 20 20 20 20 20 20 20 20 20 20 69 70 65 78 70             ipexp
0070: 6f 72 74 2e 64 20 20 20 20 20 20 20 20 20 20 20  ort.d           
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20     *..*         
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d                *.
00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .*              
00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73           Windows
0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75   API header modu
0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20  le              
0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20           *..*   
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20      *..*        
0180: 20 20 20 20 20 20 20 20 20 54 72 61 6e 73 6c 61           Transla
0190: 74 65 64 20 66 72 6f 6d 20 4d 69 6e 47 57 20 57  ted from MinGW W
01a0: 69 6e 64 6f 77 73 20 68 65 61 64 65 72 73 20 20  indows headers  
01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a                 *
01c0: 0d 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20  ..*             
01d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 79                by
01e0: 20 53 74 65 77 61 72 74 20 47 6f 72 64 6f 6e 20   Stewart Gordon 
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0200: 20 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20            *..*  
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0250: 20 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20       *..*       
0260: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0270: 50 6c 61 63 65 64 20 69 6e 74 6f 20 70 75 62 6c  Placed into publ
0280: 69 63 20 64 6f 6d 61 69 6e 20 20 20 20 20 20 20  ic domain       
0290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
02a0: 2a 0d 0a 5c 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  *..\************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02e0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2f 0d 0a 6d 6f  ***********/..mo
02f0: 64 75 6c 65 20 77 69 6e 33 32 2e 69 70 65 78 70  dule win32.ipexp
0300: 6f 72 74 3b 0d 0a 0d 0a 70 72 69 76 61 74 65 20  ort;....private 
0310: 69 6d 70 6f 72 74 20 77 69 6e 33 32 2e 77 69 6e  import win32.win
0320: 64 65 66 3b 0d 0a 0d 0a 63 6f 6e 73 74 20 73 69  def;....const si
0330: 7a 65 5f 74 20 4d 41 58 5f 41 44 41 50 54 45 52  ze_t MAX_ADAPTER
0340: 5f 4e 41 4d 45 20 3d 20 31 32 38 3b 0d 0a 0d 0a  _NAME = 128;....
0350: 2f 2f 20 49 50 20 53 54 41 54 55 53 20 66 6c 61  // IP STATUS fla
0360: 67 73 0d 0a 65 6e 75 6d 20 3a 20 49 50 5f 53 54  gs..enum : IP_ST
0370: 41 54 55 53 20 7b 0d 0a 09 49 50 5f 53 55 43 43  ATUS {...IP_SUCC
0380: 45 53 53 20 20 20 20 20 20 20 20 20 3d 20 20 20  ESS         =   
0390: 20 20 30 2c 0d 0a 09 49 50 5f 53 54 41 54 55 53    0,...IP_STATUS
03a0: 5f 42 41 53 45 20 20 20 20 20 3d 20 31 31 30 30  _BASE     = 1100
03b0: 30 2c 0d 0a 09 49 50 5f 42 55 46 5f 54 4f 4f 5f  0,...IP_BUF_TOO_
03c0: 53 4d 41 4c 4c 2c 0d 0a 09 49 50 5f 44 45 53 54  SMALL,...IP_DEST
03d0: 5f 4e 45 54 5f 55 4e 52 45 41 43 48 41 42 4c 45  _NET_UNREACHABLE
03e0: 2c 0d 0a 09 49 50 5f 44 45 53 54 5f 48 4f 53 54  ,...IP_DEST_HOST
03f0: 5f 55 4e 52 45 41 43 48 41 42 4c 45 2c 0d 0a 09  _UNREACHABLE,...
0400: 49 50 5f 44 45 53 54 5f 50 52 4f 54 5f 55 4e 52  IP_DEST_PROT_UNR
0410: 45 41 43 48 41 42 4c 45 2c 0d 0a 09 49 50 5f 44  EACHABLE,...IP_D
0420: 45 53 54 5f 50 4f 52 54 5f 55 4e 52 45 41 43 48  EST_PORT_UNREACH
0430: 41 42 4c 45 2c 0d 0a 09 49 50 5f 4e 4f 5f 52 45  ABLE,...IP_NO_RE
0440: 53 4f 55 52 43 45 53 2c 0d 0a 09 49 50 5f 42 41  SOURCES,...IP_BA
0450: 44 5f 4f 50 54 49 4f 4e 2c 0d 0a 09 49 50 5f 48  D_OPTION,...IP_H
0460: 57 5f 45 52 52 4f 52 2c 0d 0a 09 49 50 5f 50 41  W_ERROR,...IP_PA
0470: 43 4b 45 54 5f 54 4f 4f 5f 42 49 47 2c 0d 0a 09  CKET_TOO_BIG,...
0480: 49 50 5f 52 45 51 5f 54 49 4d 45 44 5f 4f 55 54  IP_REQ_TIMED_OUT
0490: 2c 0d 0a 09 49 50 5f 42 41 44 5f 52 45 51 2c 0d  ,...IP_BAD_REQ,.
04a0: 0a 09 49 50 5f 42 41 44 5f 52 4f 55 54 45 2c 0d  ..IP_BAD_ROUTE,.
04b0: 0a 09 49 50 5f 54 54 4c 5f 45 58 50 49 52 45 44  ..IP_TTL_EXPIRED
04c0: 5f 54 52 41 4e 53 49 54 2c 0d 0a 09 49 50 5f 54  _TRANSIT,...IP_T
04d0: 54 4c 5f 45 58 50 49 52 45 44 5f 52 45 41 53 53  TL_EXPIRED_REASS
04e0: 45 4d 2c 0d 0a 09 49 50 5f 50 41 52 41 4d 5f 50  EM,...IP_PARAM_P
04f0: 52 4f 42 4c 45 4d 2c 0d 0a 09 49 50 5f 53 4f 55  ROBLEM,...IP_SOU
0500: 52 43 45 5f 51 55 45 4e 43 48 2c 0d 0a 09 49 50  RCE_QUENCH,...IP
0510: 5f 4f 50 54 49 4f 4e 5f 54 4f 4f 5f 42 49 47 2c  _OPTION_TOO_BIG,
0520: 0d 0a 09 49 50 5f 42 41 44 5f 44 45 53 54 49 4e  ...IP_BAD_DESTIN
0530: 41 54 49 4f 4e 2c 0d 0a 09 49 50 5f 41 44 44 52  ATION,...IP_ADDR
0540: 5f 44 45 4c 45 54 45 44 2c 0d 0a 09 49 50 5f 53  _DELETED,...IP_S
0550: 50 45 43 5f 4d 54 55 5f 43 48 41 4e 47 45 2c 0d  PEC_MTU_CHANGE,.
0560: 0a 09 49 50 5f 4d 54 55 5f 43 48 41 4e 47 45 2c  ..IP_MTU_CHANGE,
0570: 0d 0a 09 49 50 5f 55 4e 4c 4f 41 44 2c 20 20 20  ...IP_UNLOAD,   
0580: 20 20 20 2f 2f 20 3d 20 49 50 5f 53 54 41 54 55     // = IP_STATU
0590: 53 5f 42 41 53 45 20 2b 20 32 32 0d 0a 09 49 50  S_BASE + 22...IP
05a0: 5f 47 45 4e 45 52 41 4c 5f 46 41 49 4c 55 52 45  _GENERAL_FAILURE
05b0: 20 3d 20 49 50 5f 53 54 41 54 55 53 5f 42 41 53   = IP_STATUS_BAS
05c0: 45 20 2b 20 35 30 2c 0d 0a 09 4d 41 58 5f 49 50  E + 50,...MAX_IP
05d0: 5f 53 54 41 54 55 53 20 20 20 20 20 20 3d 20 49  _STATUS      = I
05e0: 50 5f 47 45 4e 45 52 41 4c 5f 46 41 49 4c 55 52  P_GENERAL_FAILUR
05f0: 45 2c 0d 0a 09 49 50 5f 50 45 4e 44 49 4e 47 20  E,...IP_PENDING 
0600: 20 20 20 20 20 20 20 20 3d 20 49 50 5f 53 54 41          = IP_STA
0610: 54 55 53 5f 42 41 53 45 20 2b 20 32 35 35 0d 0a  TUS_BASE + 255..
0620: 7d 0d 0a 0d 0a 2f 2f 20 49 50 20 68 65 61 64 65  }....// IP heade
0630: 72 20 46 6c 61 67 73 20 76 61 6c 75 65 73 0d 0a  r Flags values..
0640: 63 6f 6e 73 74 20 62 79 74 65 20 49 50 5f 46 4c  const byte IP_FL
0650: 41 47 5f 44 46 20 3d 20 32 3b 0d 0a 0d 0a 2f 2f  AG_DF = 2;....//
0660: 20 49 50 20 4f 70 74 69 6f 6e 20 74 79 70 65 73   IP Option types
0670: 0d 0a 65 6e 75 6d 20 3a 20 75 62 79 74 65 20 7b  ..enum : ubyte {
0680: 0d 0a 09 49 50 5f 4f 50 54 5f 45 4f 4c 20 20 20  ...IP_OPT_EOL   
0690: 20 20 20 20 20 20 20 3d 20 30 2c 0d 0a 09 49 50         = 0,...IP
06a0: 5f 4f 50 54 5f 4e 4f 50 20 20 20 20 20 20 20 20  _OPT_NOP        
06b0: 20 20 3d 20 30 78 30 31 2c 0d 0a 09 49 50 5f 4f    = 0x01,...IP_O
06c0: 50 54 5f 52 52 20 20 20 20 20 20 20 20 20 20 20  PT_RR           
06d0: 3d 20 30 78 30 37 2c 0d 0a 09 49 50 5f 4f 50 54  = 0x07,...IP_OPT
06e0: 5f 53 45 43 55 52 49 54 59 20 20 20 20 20 3d 20  _SECURITY     = 
06f0: 30 78 38 32 2c 0d 0a 09 49 50 5f 4f 50 54 5f 4c  0x82,...IP_OPT_L
0700: 53 52 52 20 20 20 20 20 20 20 20 20 3d 20 30 78  SRR         = 0x
0710: 38 33 2c 0d 0a 09 49 50 5f 4f 50 54 5f 53 53 52  83,...IP_OPT_SSR
0720: 52 20 20 20 20 20 20 20 20 20 3d 20 30 78 38 39  R         = 0x89
0730: 2c 0d 0a 09 49 50 5f 4f 50 54 5f 54 53 20 20 20  ,...IP_OPT_TS   
0740: 20 20 20 20 20 20 20 20 3d 20 30 78 34 34 2c 0d          = 0x44,.
0750: 0a 09 49 50 5f 4f 50 54 5f 53 49 44 20 20 20 20  ..IP_OPT_SID    
0760: 20 20 20 20 20 20 3d 20 30 78 38 38 2c 0d 0a 09        = 0x88,...
0770: 49 50 5f 4f 50 54 5f 52 4f 55 54 45 52 5f 41 4c  IP_OPT_ROUTER_AL
0780: 45 52 54 20 3d 20 30 78 39 34 0d 0a 7d 0d 0a 0d  ERT = 0x94..}...
0790: 0a 63 6f 6e 73 74 20 75 62 79 74 65 20 4d 41 58  .const ubyte MAX
07a0: 5f 4f 50 54 5f 53 49 5a 45 20 3d 20 34 30 3b 0d  _OPT_SIZE = 40;.
07b0: 0a 0d 0a 61 6c 69 61 73 20 75 69 6e 74 20 49 50  ...alias uint IP
07c0: 41 64 64 72 2c 20 49 50 4d 61 73 6b 2c 20 49 50  Addr, IPMask, IP
07d0: 5f 53 54 41 54 55 53 3b 0d 0a 0d 0a 73 74 72 75  _STATUS;....stru
07e0: 63 74 20 49 50 5f 4f 50 54 49 4f 4e 5f 49 4e 46  ct IP_OPTION_INF
07f0: 4f 52 4d 41 54 49 4f 4e 20 7b 0d 0a 09 75 62 79  ORMATION {...uby
0800: 74 65 20 20 54 74 6c 3b 0d 0a 09 75 62 79 74 65  te  Ttl;...ubyte
0810: 20 20 54 6f 73 3b 0d 0a 09 75 62 79 74 65 20 20    Tos;...ubyte  
0820: 46 6c 61 67 73 3b 0d 0a 09 75 62 79 74 65 20 20  Flags;...ubyte  
0830: 4f 70 74 69 6f 6e 73 53 69 7a 65 3b 0d 0a 09 75  OptionsSize;...u
0840: 62 79 74 65 2a 20 4f 70 74 69 6f 6e 73 44 61 74  byte* OptionsDat
0850: 61 3b 0d 0a 7d 0d 0a 61 6c 69 61 73 20 49 50 5f  a;..}..alias IP_
0860: 4f 50 54 49 4f 4e 5f 49 4e 46 4f 52 4d 41 54 49  OPTION_INFORMATI
0870: 4f 4e 2a 20 50 49 50 5f 4f 50 54 49 4f 4e 5f 49  ON* PIP_OPTION_I
0880: 4e 46 4f 52 4d 41 54 49 4f 4e 3b 0d 0a 0d 0a 73  NFORMATION;....s
0890: 74 72 75 63 74 20 49 43 4d 50 5f 45 43 48 4f 5f  truct ICMP_ECHO_
08a0: 52 45 50 4c 59 20 7b 0d 0a 20 20 49 50 41 64 64  REPLY {..  IPAdd
08b0: 72 20 41 64 64 72 65 73 73 3b 0d 0a 20 20 75 69  r Address;..  ui
08c0: 6e 74 20 20 20 53 74 61 74 75 73 3b 0d 0a 20 20  nt   Status;..  
08d0: 75 69 6e 74 20 20 20 52 6f 75 6e 64 54 72 69 70  uint   RoundTrip
08e0: 54 69 6d 65 3b 0d 0a 20 20 75 73 68 6f 72 74 20  Time;..  ushort 
08f0: 44 61 74 61 53 69 7a 65 3b 0d 0a 20 20 75 73 68  DataSize;..  ush
0900: 6f 72 74 20 52 65 73 65 72 76 65 64 3b 0d 0a 20  ort Reserved;.. 
0910: 20 76 6f 69 64 2a 20 20 44 61 74 61 3b 0d 0a 20   void*  Data;.. 
0920: 20 49 50 5f 4f 50 54 49 4f 4e 5f 49 4e 46 4f 52   IP_OPTION_INFOR
0930: 4d 41 54 49 4f 4e 20 4f 70 74 69 6f 6e 73 3b 0d  MATION Options;.
0940: 0a 7d 0d 0a 61 6c 69 61 73 20 49 43 4d 50 5f 45  .}..alias ICMP_E
0950: 43 48 4f 5f 52 45 50 4c 59 2a 20 50 49 43 4d 50  CHO_REPLY* PICMP
0960: 5f 45 43 48 4f 5f 52 45 50 4c 59 3b 0d 0a 0d 0a  _ECHO_REPLY;....
0970: 73 74 72 75 63 74 20 49 50 5f 41 44 41 50 54 45  struct IP_ADAPTE
0980: 52 5f 49 4e 44 45 58 5f 4d 41 50 20 7b 0d 0a 09  R_INDEX_MAP {...
0990: 55 4c 4f 4e 47 20 20 20 20 20 20 20 20 20 20 20  ULONG           
09a0: 20 20 20 20 20 20 20 20 49 6e 64 65 78 3b 0d 0a          Index;..
09b0: 09 57 43 48 41 52 5b 4d 41 58 5f 41 44 41 50 54  .WCHAR[MAX_ADAPT
09c0: 45 52 5f 4e 41 4d 45 5d 20 4e 61 6d 65 3b 0d 0a  ER_NAME] Name;..
09d0: 7d 0d 0a 61 6c 69 61 73 20 49 50 5f 41 44 41 50  }..alias IP_ADAP
09e0: 54 45 52 5f 49 4e 44 45 58 5f 4d 41 50 2a 20 50  TER_INDEX_MAP* P
09f0: 49 50 5f 41 44 41 50 54 45 52 5f 49 4e 44 45 58  IP_ADAPTER_INDEX
0a00: 5f 4d 41 50 3b 0d 0a 0d 0a 73 74 72 75 63 74 20  _MAP;....struct 
0a10: 49 50 5f 49 4e 54 45 52 46 41 43 45 5f 49 4e 46  IP_INTERFACE_INF
0a20: 4f 20 7b 0d 0a 09 4c 4f 4e 47 20 20 20 20 20 20  O {...LONG      
0a30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 75                Nu
0a40: 6d 41 64 61 70 74 65 72 73 3b 0d 0a 09 49 50 5f  mAdapters;...IP_
0a50: 41 44 41 50 54 45 52 5f 49 4e 44 45 58 5f 4d 41  ADAPTER_INDEX_MA
0a60: 50 5b 31 5d 20 5f 41 64 61 70 74 65 72 3b 0d 0a  P[1] _Adapter;..
0a70: 0d 0a 09 49 50 5f 41 44 41 50 54 45 52 5f 49 4e  ...IP_ADAPTER_IN
0a80: 44 45 58 5f 4d 41 50 2a 20 41 64 61 70 74 65 72  DEX_MAP* Adapter
0a90: 28 29 20 7b 20 72 65 74 75 72 6e 20 5f 41 64 61  () { return _Ada
0aa0: 70 74 65 72 2e 70 74 72 3b 20 7d 0d 0a 7d 0d 0a  pter.ptr; }..}..
0ab0: 61 6c 69 61 73 20 49 50 5f 49 4e 54 45 52 46 41  alias IP_INTERFA
0ac0: 43 45 5f 49 4e 46 4f 2a 20 50 49 50 5f 49 4e 54  CE_INFO* PIP_INT
0ad0: 45 52 46 41 43 45 5f 49 4e 46 4f 3b 0d 0a 0d 0a  ERFACE_INFO;....
0ae0: 73 74 72 75 63 74 20 49 50 5f 55 4e 49 44 49 52  struct IP_UNIDIR
0af0: 45 43 54 49 4f 4e 41 4c 5f 41 44 41 50 54 45 52  ECTIONAL_ADAPTER
0b00: 5f 41 44 44 52 45 53 53 20 7b 0d 0a 09 55 4c 4f  _ADDRESS {...ULO
0b10: 4e 47 20 20 20 20 20 4e 75 6d 41 64 61 70 74 65  NG     NumAdapte
0b20: 72 73 3b 0d 0a 09 49 50 41 64 64 72 5b 31 5d 20  rs;...IPAddr[1] 
0b30: 5f 41 64 64 72 65 73 73 3b 0d 0a 0d 0a 09 49 50  _Address;.....IP
0b40: 41 64 64 72 2a 20 41 64 64 72 65 73 73 28 29 20  Addr* Address() 
0b50: 7b 20 72 65 74 75 72 6e 20 5f 41 64 64 72 65 73  { return _Addres
0b60: 73 2e 70 74 72 3b 20 7d 0d 0a 7d 0d 0a 61 6c 69  s.ptr; }..}..ali
0b70: 61 73 20 49 50 5f 55 4e 49 44 49 52 45 43 54 49  as IP_UNIDIRECTI
0b80: 4f 4e 41 4c 5f 41 44 41 50 54 45 52 5f 41 44 44  ONAL_ADAPTER_ADD
0b90: 52 45 53 53 2a 20 50 49 50 5f 55 4e 49 44 49 52  RESS* PIP_UNIDIR
0ba0: 45 43 54 49 4f 4e 41 4c 5f 41 44 41 50 54 45 52  ECTIONAL_ADAPTER
0bb0: 5f 41 44 44 52 45 53 53 3b 0d 0a                 _ADDRESS;..