00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __LIBNET_HEADERS_H
00033 #define __LIBNET_HEADERS_H
00034
00042 #define LIBNET_802_1Q_H 0x12
00043 #define LIBNET_802_1X_H 0x04
00044 #define LIBNET_802_2_H 0x03
00045 #define LIBNET_802_2SNAP_H 0x08
00046 #define LIBNET_802_3_H 0x0e
00047 #define LIBNET_ARP_H 0x08
00048 #define LIBNET_ARP_ETH_IP_H 0x1c
00049 #define LIBNET_BGP4_HEADER_H 0x13
00050 #define LIBNET_BGP4_OPEN_H 0x0a
00051 #define LIBNET_BGP4_UPDATE_H 0x04
00052 #define LIBNET_BGP4_NOTIFICATION_H 0x02
00053 #define LIBNET_CDP_H 0x08
00054 #define LIBNET_DHCPV4_H 0xf0
00055 #define LIBNET_UDP_DNSV4_H 0x0c
00056 #define LIBNET_TCP_DNSV4_H 0x0e
00057 #define LIBNET_ETH_H 0x0e
00058 #define LIBNET_FDDI_H 0x15
00059 #define LIBNET_ICMPV4_H 0x04
00060 #define LIBNET_ICMPV4_ECHO_H 0x08
00061 #define LIBNET_ICMPV4_MASK_H 0x0c
00062 #define LIBNET_ICMPV4_UNREACH_H 0x08
00063 #define LIBNET_ICMPV4_TIMXCEED_H 0x08
00064 #define LIBNET_ICMPV4_REDIRECT_H 0x08
00065 #define LIBNET_ICMPV4_TS_H 0x14
00066 #define LIBNET_ICMPV6_H 0x08
00067 #define LIBNET_IGMP_H 0x08
00068 #define LIBNET_IPV4_H 0x14
00069 #define LIBNET_IPV6_H 0x28
00070 #define LIBNET_IPV6_FRAG_H 0x08
00071 #define LIBNET_IPV6_ROUTING_H 0x04
00072 #define LIBNET_IPV6_DESTOPTS_H 0x02
00073 #define LIBNET_IPV6_HBHOPTS_H 0x02
00074 #define LIBNET_IPSEC_ESP_HDR_H 0x0c
00075 #define LIBNET_IPSEC_ESP_FTR_H 0x02
00076 #define LIBNET_IPSEC_AH_H 0x10
00077 #define LIBNET_ISL_H 0x1a
00078 #define LIBNET_GRE_H 0x04
00079 #define LIBNET_GRE_SRE_H 0x04
00080 #define LIBNET_MPLS_H 0x04
00081 #define LIBNET_OSPF_H 0x10
00082 #define LIBNET_OSPF_HELLO_H 0x18
00083 #define LIBNET_OSPF_DBD_H 0x08
00084 #define LIBNET_OSPF_LSR_H 0x0c
00085 #define LIBNET_OSPF_LSU_H 0x04
00086 #define LIBNET_OSPF_LSA_H 0x14
00087 #define LIBNET_OSPF_AUTH_H 0x08
00088 #define LIBNET_OSPF_CKSUM 0x10
00089 #define LIBNET_OSPF_LS_RTR_H 0x10
00090 #define LIBNET_OSPF_LS_NET_H 0x08
00091 #define LIBNET_OSPF_LS_SUM_H 0x0c
00092 #define LIBNET_OSPF_LS_AS_EXT_H 0x10
00093 #define LIBNET_NTP_H 0x30
00094 #define LIBNET_RIP_H 0x18
00095 #define LIBNET_RPC_CALL_H 0x28
00098 #define LIBNET_RPC_CALL_TCP_H 0x2c
00101 #define LIBNET_STP_CONF_H 0x23
00102 #define LIBNET_STP_TCN_H 0x04
00103 #define LIBNET_TOKEN_RING_H 0x16
00104 #define LIBNET_TCP_H 0x14
00105 #define LIBNET_UDP_H 0x08
00106 #define LIBNET_VRRP_H 0x08
00112 struct libnet_802_1q_hdr
00113 {
00114 u_int8_t vlan_dhost[ETHER_ADDR_LEN];
00115 u_int8_t vlan_shost[ETHER_ADDR_LEN];
00116 u_int16_t vlan_tpi;
00117 u_int16_t vlan_priority_c_vid;
00118 #define LIBNET_802_1Q_PRIMASK 0x0007
00119 #define LIBNET_802_1Q_CFIMASK 0x0001
00120 #define LIBNET_802_1Q_VIDMASK 0x0fff
00121 u_int16_t vlan_len;
00122 };
00123
00128 struct libnet_802_1x_hdr
00129 {
00130 u_int8_t dot1x_version;
00131 u_int8_t dot1x_type;
00132 #define LIBNET_802_1X_PACKET 0x00
00133 #define LIBNET_802_1X_START 0x01
00134 #define LIBNET_802_1X_LOGOFF 0x02
00135 #define LIBNET_802_1X_KEY 0x03
00136 #define LIBNET_802_1X_ENCASFAL 0x04
00137 u_int16_t dot1x_length;
00138 };
00139
00140
00141
00142
00143
00144
00145 struct libnet_802_2_hdr
00146 {
00147 u_int8_t llc_dsap;
00148 u_int8_t llc_ssap;
00149 #define LIBNET_SAP_STP 0x42
00150 #define LIBNET_SAP_SNAP 0xaa
00151 u_int8_t llc_control;
00152 };
00153
00154
00155
00156
00157
00158
00159
00160 struct libnet_802_2snap_hdr
00161 {
00162 u_int8_t snap_dsap;
00163 u_int8_t snap_ssap;
00164 u_int8_t snap_control;
00165 u_int8_t snap_oui[3];
00166 u_int16_t snap_type;
00167 };
00168
00169
00170
00171
00172
00173
00174
00175 struct libnet_802_3_hdr
00176 {
00177 u_int8_t _802_3_dhost[ETHER_ADDR_LEN];
00178 u_int8_t _802_3_shost[ETHER_ADDR_LEN];
00179 u_int16_t _802_3_len;
00180 };
00181
00182
00183
00184
00185
00186
00187
00188 struct libnet_arp_hdr
00189 {
00190 u_int16_t ar_hrd;
00191 #define ARPHRD_NETROM 0
00192 #define ARPHRD_ETHER 1
00193 #define ARPHRD_EETHER 2
00194 #define ARPHRD_AX25 3
00195 #define ARPHRD_PRONET 4
00196 #define ARPHRD_CHAOS 5
00197 #define ARPHRD_IEEE802 6
00198 #define ARPHRD_ARCNET 7
00199 #define ARPHRD_APPLETLK 8
00200 #define ARPHRD_LANSTAR 9
00201 #define ARPHRD_DLCI 15
00202 #define ARPHRD_ATM 19
00203 #define ARPHRD_METRICOM 23
00204 #define ARPHRD_IPSEC 31
00205 u_int16_t ar_pro;
00206 u_int8_t ar_hln;
00207 u_int8_t ar_pln;
00208 u_int16_t ar_op;
00209 #define ARPOP_REQUEST 1
00210 #define ARPOP_REPLY 2
00211 #define ARPOP_REVREQUEST 3
00212 #define ARPOP_REVREPLY 4
00213 #define ARPOP_INVREQUEST 8
00214 #define ARPOP_INVREPLY 9
00215
00216 };
00217
00218
00219
00220
00221
00222
00223 struct libnet_bgp4_header_hdr
00224 {
00225 #define LIBNET_BGP4_MARKER_SIZE 16
00226 u_int8_t marker[LIBNET_BGP4_MARKER_SIZE];
00227 u_int16_t len;
00228 u_int8_t type;
00229 #define LIBNET_BGP4_OPEN 1
00230 #define LIBNET_BGP4_UPDATE 2
00231 #define LIBNET_BGP4_NOTIFICATION 3
00232 #define LIBNET_BGP4_KEEPALIVE 4
00233 };
00234
00235
00236
00237
00238
00239
00240 struct libnet_bgp4_open_hdr
00241 {
00242 u_int8_t version;
00243 u_int16_t src_as;
00244 u_int16_t hold_time;
00245 u_int32_t bgp_id;
00246 u_int8_t opt_len;
00247 };
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257 struct libnet_bgp4_notification_hdr
00258 {
00259 #define LIBNET_BGP4_MESSAGE_HEADER_ERROR 1
00260 #define LIBNET_BGP4_OPEN_MESSAGE_ERROR 2
00261 #define LIBNET_BGP4_UPDATE_MESSAGE_ERROR 3
00262 #define LIBNET_BGP4_HOLD_TIMER_EXPIRED 4
00263 #define LIBNET_BGP4_FINITE_STATE__ERROR 5
00264 #define LIBNET_BGP4_CEASE 6
00265 u_int8_t err_code;
00266
00267
00268 #define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED 1
00269 #define LIBNET_BGP4_BAD_MESSAGE_LENGTH 2
00270 #define LIBNET_BGP4_BAD_MESSAGE_TYPE 3
00271
00272 #define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER 1
00273 #define LIBNET_BGP4_BAD_PEER_AS 2
00274 #define LIBNET_BGP4_BAD_BGP_IDENTIFIER 3
00275 #define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4
00276 #define LIBNET_BGP4_AUTHENTICATION_FAILURE 5
00277 #define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME 6
00278
00279 #define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST
00280 #define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE
00281 #define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE
00282 #define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR
00283 #define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR
00284 #define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE
00285 #define LIBNET_BGP4_AS_ROUTING_LOOP
00286 #define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE
00287 #define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR
00288 #define LIBNET_BGP4_INVALID_NETWORK_FIELD
00289 #define LIBNET_BGP4_MALFORMED_AS_PATH
00290 u_int8_t err_subcode;
00291 };
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305 #define LIBNET_PROTO_CDP 200
00306 struct libnet_cdp_hdr
00307 {
00308 u_int8_t cdp_version;
00309 u_int8_t cdp_ttl;
00310 u_int16_t cdp_sum;
00311 u_int16_t cdp_type;
00312 #define LIBNET_CDP_DEVID 0x1
00313 #define LIBNET_CDP_ADDRESS 0x2
00314 #define LIBNET_CDP_PORTID 0x3
00315 #define LIBNET_CDP_CAPABIL 0x4
00316 #define LIBNET_CDP_VERSION 0x5
00317 #define LIBNET_CDP_PLATFORM 0x6
00318 #define LIBNET_CDP_IPPREFIX 0x7
00319 u_int16_t cdp_len;
00320
00321
00322
00323 #define LIBNET_CDP_CAP_L3R 0x01
00324 #define LIBNET_CDP_CAP_L2B 0x02
00325 #define LIBNET_CDP_CAP_L2SRB 0x04
00326 #define LIBNET_CDP_CAP_L2S 0x08
00327 #define LIBNET_CDP_CAP_SR 0x10
00328 #define LIBNET_CDP_CAP_NOI 0x20
00329 #define LIBNET_CDP_CAP_L1F 0x40
00330 };
00331
00332
00333
00334
00335
00336 struct libnet_cdp_value_hdr
00337 {
00338 u_int16_t cdp_type;
00339 u_int16_t cdp_len;
00340 };
00341
00342
00343
00344
00345
00346
00347
00348 struct libnet_dhcpv4_hdr
00349 {
00350 u_int8_t dhcp_opcode;
00351 #define LIBNET_DHCP_REQUEST 0x1
00352 #define LIBNET_DHCP_REPLY 0x2
00353 u_int8_t dhcp_htype;
00354 u_int8_t dhcp_hlen;
00355 u_int8_t dhcp_hopcount;
00356 u_int32_t dhcp_xid;
00357 u_int16_t dhcp_secs;
00358 u_int16_t dhcp_flags;
00359 u_int32_t dhcp_cip;
00360 u_int32_t dhcp_yip;
00361 u_int32_t dhcp_sip;
00362 u_int32_t dhcp_gip;
00363 u_int8_t dhcp_chaddr[16];
00364 u_int8_t dhcp_sname[64];
00365 u_int8_t dhcp_file[128];
00366 u_int32_t dhcp_magic;
00367 #define DHCP_MAGIC 0x63825363
00368 #define LIBNET_BOOTP_MIN_LEN 0x12c
00369 #define LIBNET_DHCP_PAD 0x00
00370 #define LIBNET_DHCP_SUBNETMASK 0x01
00371 #define LIBNET_DHCP_TIMEOFFSET 0x02
00372 #define LIBNET_DHCP_ROUTER 0x03
00373 #define LIBNET_DHCP_TIMESERVER 0x04
00374 #define LIBNET_DHCP_NAMESERVER 0x05
00375 #define LIBNET_DHCP_DNS 0x06
00376 #define LIBNET_DHCP_LOGSERV 0x07
00377 #define LIBNET_DHCP_COOKIESERV 0x08
00378 #define LIBNET_DHCP_LPRSERV 0x09
00379 #define LIBNET_DHCP_IMPSERV 0x0a
00380 #define LIBNET_DHCP_RESSERV 0x0b
00381 #define LIBNET_DHCP_HOSTNAME 0x0c
00382 #define LIBNET_DHCP_BOOTFILESIZE 0x0d
00383 #define LIBNET_DHCP_DUMPFILE 0x0e
00384 #define LIBNET_DHCP_DOMAINNAME 0x0f
00385 #define LIBNET_DHCP_SWAPSERV 0x10
00386 #define LIBNET_DHCP_ROOTPATH 0x11
00387 #define LIBNET_DHCP_EXTENPATH 0x12
00388 #define LIBNET_DHCP_IPFORWARD 0x13
00389 #define LIBNET_DHCP_SRCROUTE 0x14
00390 #define LIBNET_DHCP_POLICYFILTER 0x15
00391 #define LIBNET_DHCP_MAXASMSIZE 0x16
00392 #define LIBNET_DHCP_IPTTL 0x17
00393 #define LIBNET_DHCP_MTUTIMEOUT 0x18
00394 #define LIBNET_DHCP_MTUTABLE 0x19
00395 #define LIBNET_DHCP_MTUSIZE 0x1a
00396 #define LIBNET_DHCP_LOCALSUBNETS 0x1b
00397 #define LIBNET_DHCP_BROADCASTADDR 0x1c
00398 #define LIBNET_DHCP_DOMASKDISCOV 0x1d
00399 #define LIBNET_DHCP_MASKSUPPLY 0x1e
00400 #define LIBNET_DHCP_DOROUTEDISC 0x1f
00401 #define LIBNET_DHCP_ROUTERSOLICIT 0x20
00402 #define LIBNET_DHCP_STATICROUTE 0x21
00403 #define LIBNET_DHCP_TRAILERENCAP 0x22
00404 #define LIBNET_DHCP_ARPTIMEOUT 0x23
00405 #define LIBNET_DHCP_ETHERENCAP 0x24
00406 #define LIBNET_DHCP_TCPTTL 0x25
00407 #define LIBNET_DHCP_TCPKEEPALIVE 0x26
00408 #define LIBNET_DHCP_TCPALIVEGARBAGE 0x27
00409 #define LIBNET_DHCP_NISDOMAIN 0x28
00410 #define LIBNET_DHCP_NISSERVERS 0x29
00411 #define LIBNET_DHCP_NISTIMESERV 0x2a
00412 #define LIBNET_DHCP_VENDSPECIFIC 0x2b
00413 #define LIBNET_DHCP_NBNS 0x2c
00414 #define LIBNET_DHCP_NBDD 0x2d
00415 #define LIBNET_DHCP_NBTCPIP 0x2e
00416 #define LIBNET_DHCP_NBTCPSCOPE 0x2f
00417 #define LIBNET_DHCP_XFONT 0x30
00418 #define LIBNET_DHCP_XDISPLAYMGR 0x31
00419 #define LIBNET_DHCP_DISCOVERADDR 0x32
00420 #define LIBNET_DHCP_LEASETIME 0x33
00421 #define LIBNET_DHCP_OPTIONOVERLOAD 0x34
00422 #define LIBNET_DHCP_MESSAGETYPE 0x35
00423 #define LIBNET_DHCP_SERVIDENT 0x36
00424 #define LIBNET_DHCP_PARAMREQUEST 0x37
00425 #define LIBNET_DHCP_MESSAGE 0x38
00426 #define LIBNET_DHCP_MAXMSGSIZE 0x39
00427 #define LIBNET_DHCP_RENEWTIME 0x3a
00428 #define LIBNET_DHCP_REBINDTIME 0x3b
00429 #define LIBNET_DHCP_CLASSSID 0x3c
00430 #define LIBNET_DHCP_CLIENTID 0x3d
00431 #define LIBNET_DHCP_NISPLUSDOMAIN 0x40
00432 #define LIBNET_DHCP_NISPLUSSERVERS 0x41
00433 #define LIBNET_DHCP_MOBILEIPAGENT 0x44
00434 #define LIBNET_DHCP_SMTPSERVER 0x45
00435 #define LIBNET_DHCP_POP3SERVER 0x46
00436 #define LIBNET_DHCP_NNTPSERVER 0x47
00437 #define LIBNET_DHCP_WWWSERVER 0x48
00438 #define LIBNET_DHCP_FINGERSERVER 0x49
00439 #define LIBNET_DHCP_IRCSERVER 0x4a
00440 #define LIBNET_DHCP_STSERVER 0x4b
00441 #define LIBNET_DHCP_STDASERVER 0x4c
00442 #define LIBNET_DHCP_END 0xff
00443
00444 #define LIBNET_DHCP_MSGDISCOVER 0x01
00445 #define LIBNET_DHCP_MSGOFFER 0x02
00446 #define LIBNET_DHCP_MSGREQUEST 0x03
00447 #define LIBNET_DHCP_MSGDECLINE 0x04
00448 #define LIBNET_DHCP_MSGACK 0x05
00449 #define LIBNET_DHCP_MSGNACK 0x06
00450 #define LIBNET_DHCP_MSGRELEASE 0x07
00451 #define LIBNET_DHCP_MSGINFORM 0x08
00452 };
00453
00454
00455
00456
00457
00458
00459
00460
00461 #define LIBNET_DNS_H LIBNET_UDP_DNSV4_H
00462 struct libnet_dnsv4_hdr
00463 {
00464 u_int16_t h_len;
00465 u_int16_t id;
00466 u_int16_t flags;
00467 u_int16_t num_q;
00468 u_int16_t num_answ_rr;
00469 u_int16_t num_auth_rr;
00470 u_int16_t num_addi_rr;
00471 };
00472
00473
00474
00475
00476
00477
00478 struct libnet_ethernet_hdr
00479 {
00480 u_int8_t ether_dhost[ETHER_ADDR_LEN];
00481 u_int8_t ether_shost[ETHER_ADDR_LEN];
00482 u_int16_t ether_type;
00483 };
00484
00485 #ifndef ETHERTYPE_PUP
00486 #define ETHERTYPE_PUP 0x0200
00487 #endif
00488 #ifndef ETHERTYPE_IP
00489 #define ETHERTYPE_IP 0x0800
00490 #endif
00491 #ifndef ETHERTYPE_ARP
00492 #define ETHERTYPE_ARP 0x0806
00493 #endif
00494 #ifndef ETHERTYPE_REVARP
00495 #define ETHERTYPE_REVARP 0x8035
00496 #endif
00497 #ifndef ETHERTYPE_VLAN
00498 #define ETHERTYPE_VLAN 0x8100
00499 #endif
00500 #ifndef ETHERTYPE_EAP
00501 #define ETHERTYPE_EAP 0x888e
00502 #endif
00503 #ifndef ETHERTYPE_MPLS
00504 #define ETHERTYPE_MPLS 0x8847
00505 #endif
00506 #ifndef ETHERTYPE_LOOPBACK
00507 #define ETHERTYPE_LOOPBACK 0x9000
00508 #endif
00509
00510 struct libnet_ether_addr
00511 {
00512 u_int8_t ether_addr_octet[6];
00513 };
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524 struct libnet_fddi_hdr
00525 {
00526 u_int8_t fddi_frame_control;
00527 #define LIBNET_FDDI_LLC_FRAME 0x10
00528 #define LIBNET_FDDI_48BIT_ADDR 0x40
00529 #define LIBNET_FDDI_FC_REQD LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR
00530 u_int8_t fddi_dhost[FDDI_ADDR_LEN];
00531 u_int8_t fddi_shost[FDDI_ADDR_LEN];
00532 u_int8_t fddi_llc_dsap;
00533 u_int8_t fddi_llc_ssap;
00534 u_int8_t fddi_llc_control_field;
00535 u_int8_t fddi_llc_org_code[LIBNET_ORG_CODE_SIZE];
00536 u_int8_t fddi_type;
00537 u_int8_t fddi_type1;
00538 #define FDDI_TYPE_IP 0x0800
00539 #define FDDI_TYPE_ARP 0x0806
00540 #define FDDI_TYPE_REVARP 0x8035
00541 };
00542
00543
00544 struct libnet_fddi_addr
00545 {
00546 u_int8_t fddi_addr_octet[6];
00547 };
00548
00549
00550
00551
00552
00553
00554
00555 struct libnet_gre_hdr
00556 {
00557 u_int16_t flags_ver;
00558 #define GRE_CSUM 0x8000
00559 #define GRE_ROUTING 0x4000
00560 #define GRE_KEY 0x2000
00561 #define GRE_SEQ 0x1000
00562 #define GRE_STRICT 0x0800
00563 #define GRE_REC 0x0700
00564 #define GRE_ACK 0x0080
00565
00566 #define GRE_FLAGS_MASK 0x00F8
00567 #define GRE_VERSION_MASK 0x0007
00568
00569 #define GRE_VERSION_0 0x0000
00570 #define GRE_VERSION_1 0x0001
00571
00572 u_int16_t type;
00573 #define GRE_SNA 0x0004
00574 #define GRE_OSI_NETWORK_LAYER 0x00FE
00575 #define GRE_PUP 0x0200
00576 #define GRE_XNS 0x0600
00577 #define GRE_IP 0x0800
00578 #define GRE_CHAOS 0x0804
00579 #define GRE_RFC_826_ARP 0x0806
00580 #define GRE_FRAME_RELAY_ARP 0x0808
00581 #define GRE_VINES 0x0BAD
00582 #define GRE_VINES_ECHO 0x0BAE
00583 #define GRE_VINES_LOOPBACK 0x0BAF
00584 #define GRE_DECNET 0x6003
00585 #define GRE_TRANSPARENT_ETHERNET_BRIDGING 0x6558
00586 #define GRE_RAW_FRAME_RELAY 0x6559
00587 #define GRE_APOLLO_DOMAIN 0x8019
00588 #define GRE_ETHERTALK 0x809B
00589 #define GRE_NOVELL_IPX 0x8137
00590 #define GRE_RFC_1144_TCP_IP_COMPRESSION 0x876B
00591 #define GRE_IP_AUTONOMOUS_SYSTEMS 0x876C
00592 #define GRE_SECURE_DATA 0x876D
00593 #define GRE_PPP 0x880b
00594
00595 union {
00596 struct {
00597 u_int16_t checksum;
00598 u_int16_t offset;
00599 u_int32_t key;
00600 u_int32_t seq;
00601 } _gre;
00602
00603 struct {
00604 u_int16_t payload_s;
00605 u_int16_t callID;
00606 u_int32_t seq;
00607 u_int32_t ack;
00608 } _egre;
00609 }_data;
00610
00611 #define gre_checksum _data._gre.checksum
00612 #define gre_offset _data._gre.offset
00613 #define gre_key _data._gre.key
00614 #define gre_seq _data._gre.seq
00615
00616 #define egre_payload_s _data._egre.payload_s
00617 #define egre_callID _data._egre.callID
00618 #define egre_seq _data._egre.seq
00619 #define egre_ack _data._egre.ack
00620 };
00621
00622
00623 #ifndef IPPROTO_GRE
00624 #define IPPROTO_GRE 47
00625 #endif
00626
00627
00628
00629
00630
00631
00632 struct libnet_gre_sre_hdr
00633 {
00634 u_int16_t af;
00635 u_int8_t sre_offset;
00636 u_int8_t sre_length;
00637 u_int8_t *routing;
00638 };
00639
00640
00641
00642
00643
00644
00645
00646 struct libnet_ipv4_hdr
00647 {
00648 #if (LIBNET_LIL_ENDIAN)
00649 u_int8_t ip_hl:4,
00650 ip_v:4;
00651 #endif
00652 #if (LIBNET_BIG_ENDIAN)
00653 u_int8_t ip_v:4,
00654 ip_hl:4;
00655 #endif
00656 u_int8_t ip_tos;
00657 #ifndef IPTOS_LOWDELAY
00658 #define IPTOS_LOWDELAY 0x10
00659 #endif
00660 #ifndef IPTOS_THROUGHPUT
00661 #define IPTOS_THROUGHPUT 0x08
00662 #endif
00663 #ifndef IPTOS_RELIABILITY
00664 #define IPTOS_RELIABILITY 0x04
00665 #endif
00666 #ifndef IPTOS_LOWCOST
00667 #define IPTOS_LOWCOST 0x02
00668 #endif
00669 u_int16_t ip_len;
00670 u_int16_t ip_id;
00671 u_int16_t ip_off;
00672 #ifndef IP_RF
00673 #define IP_RF 0x8000
00674 #endif
00675 #ifndef IP_DF
00676 #define IP_DF 0x4000
00677 #endif
00678 #ifndef IP_MF
00679 #define IP_MF 0x2000
00680 #endif
00681 #ifndef IP_OFFMASK
00682 #define IP_OFFMASK 0x1fff
00683 #endif
00684 u_int8_t ip_ttl;
00685 u_int8_t ip_p;
00686 u_int16_t ip_sum;
00687 struct in_addr ip_src, ip_dst;
00688 };
00689
00690
00691
00692
00693 #ifndef IPOPT_EOL
00694 #define IPOPT_EOL 0
00695 #endif
00696 #ifndef IPOPT_NOP
00697 #define IPOPT_NOP 1
00698 #endif
00699 #ifndef IPOPT_RR
00700 #define IPOPT_RR 7
00701 #endif
00702 #ifndef IPOPT_TS
00703 #define IPOPT_TS 68
00704 #endif
00705 #ifndef IPOPT_SECURITY
00706 #define IPOPT_SECURITY 130
00707 #endif
00708 #ifndef IPOPT_LSRR
00709 #define IPOPT_LSRR 131
00710 #endif
00711 #ifndef IPOPT_SATID
00712 #define IPOPT_SATID 136
00713 #endif
00714 #ifndef IPOPT_SSRR
00715 #define IPOPT_SSRR 137
00716 #endif
00717
00718 struct libnet_in6_addr
00719 {
00720 union
00721 {
00722 u_int8_t __u6_addr8[16];
00723 u_int16_t __u6_addr16[8];
00724 u_int32_t __u6_addr32[4];
00725 } __u6_addr;
00726 };
00727 #define libnet_s6_addr __u6_addr.__u6_addr8
00728
00729
00730
00731
00732
00733
00734 struct libnet_ipv6_hdr
00735 {
00736 u_int8_t ip_flags[4];
00737 u_int16_t ip_len;
00738 u_int8_t ip_nh;
00739 u_int8_t ip_hl;
00740 struct libnet_in6_addr ip_src, ip_dst;
00741
00742 };
00743
00744
00745
00746
00747
00748
00749 #define LIBNET_IPV6_NH_FRAGMENT 44
00750 struct libnet_ipv6_frag_hdr
00751 {
00752 u_int8_t ip_nh;
00753 u_int8_t ip_reserved;
00754 u_int16_t ip_frag;
00755 u_int32_t ip_id;
00756 };
00757
00758
00759
00760
00761
00762
00763 #define LIBNET_IPV6_NH_ROUTING 43
00764 struct libnet_ipv6_routing_hdr
00765 {
00766 u_int8_t ip_nh;
00767 u_int8_t ip_len;
00768 u_int8_t ip_rtype;
00769 u_int8_t ip_segments;
00770
00771 };
00772
00773
00774
00775
00776
00777
00778 #define LIBNET_IPV6_NH_DESTOPTS 60
00779 struct libnet_ipv6_destopts_hdr
00780 {
00781 u_int8_t ip_nh;
00782 u_int8_t ip_len;
00783
00784 };
00785
00786
00787
00788
00789
00790
00791 #define LIBNET_IPV6_NH_HBH 0
00792 struct libnet_ipv6_hbhopts_hdr
00793 {
00794 u_int8_t ip_nh;
00795 u_int8_t ip_len;
00796
00797 };
00798
00799
00800
00801
00802
00803
00804 #ifndef IPPROTO_ICMP6
00805 #define IPPROTO_ICMP6 0x3a
00806 #endif
00807 struct libnet_icmpv6_hdr
00808 {
00809 u_int8_t icmp_type;
00810 #ifndef ICMP6_ECHO
00811 #define ICMP6_ECHO 128
00812 #endif
00813 #ifndef ICMP6_ECHOREPLY
00814 #define ICMP6_ECHOREPLY 129
00815 #endif
00816 #ifndef ICMP6_UNREACH
00817 #define ICMP6_UNREACH 1
00818 #endif
00819 #ifndef ICMP6_PKTTOOBIG
00820 #define ICMP6_PKTTOOBIG 2
00821 #endif
00822 #ifndef ICMP6_TIMXCEED
00823 #define ICMP6_TIMXCEED 3
00824 #endif
00825 #ifndef ICMP6_PARAMPROB
00826 #define ICMP6_PARAMPROB 4
00827 #endif
00828 u_int8_t icmp_code;
00829 u_int16_t icmp_sum;
00830 u_int16_t id;
00831 u_int16_t seq;
00832 };
00833
00834
00835
00836
00837
00838
00839
00840
00841 struct libnet_icmpv4_hdr
00842 {
00843 u_int8_t icmp_type;
00844 #ifndef ICMP_ECHOREPLY
00845 #define ICMP_ECHOREPLY 0
00846 #endif
00847 #ifndef ICMP_UNREACH
00848 #define ICMP_UNREACH 3
00849 #endif
00850 #ifndef ICMP_SOURCEQUENCH
00851 #define ICMP_SOURCEQUENCH 4
00852 #endif
00853 #ifndef ICMP_REDIRECT
00854 #define ICMP_REDIRECT 5
00855 #endif
00856 #ifndef ICMP_ECHO
00857 #define ICMP_ECHO 8
00858 #endif
00859 #ifndef ICMP_ROUTERADVERT
00860 #define ICMP_ROUTERADVERT 9
00861 #endif
00862 #ifndef ICMP_ROUTERSOLICIT
00863 #define ICMP_ROUTERSOLICIT 10
00864 #endif
00865 #ifndef ICMP_TIMXCEED
00866 #define ICMP_TIMXCEED 11
00867 #endif
00868 #ifndef ICMP_PARAMPROB
00869 #define ICMP_PARAMPROB 12
00870 #endif
00871 #ifndef ICMP_TSTAMP
00872 #define ICMP_TSTAMP 13
00873 #endif
00874 #ifndef ICMP_TSTAMPREPLY
00875 #define ICMP_TSTAMPREPLY 14
00876 #endif
00877 #ifndef ICMP_IREQ
00878 #define ICMP_IREQ 15
00879 #endif
00880 #ifndef ICMP_IREQREPLY
00881 #define ICMP_IREQREPLY 16
00882 #endif
00883 #ifndef ICMP_MASKREQ
00884 #define ICMP_MASKREQ 17
00885 #endif
00886 #ifndef ICMP_MASKREPLY
00887 #define ICMP_MASKREPLY 18
00888 #endif
00889 u_int8_t icmp_code;
00890 #ifndef ICMP_UNREACH_NET
00891 #define ICMP_UNREACH_NET 0
00892 #endif
00893 #ifndef ICMP_UNREACH_HOST
00894 #define ICMP_UNREACH_HOST 1
00895 #endif
00896 #ifndef ICMP_UNREACH_PROTOCOL
00897 #define ICMP_UNREACH_PROTOCOL 2
00898 #endif
00899 #ifndef ICMP_UNREACH_PORT
00900 #define ICMP_UNREACH_PORT 3
00901 #endif
00902 #ifndef ICMP_UNREACH_NEEDFRAG
00903 #define ICMP_UNREACH_NEEDFRAG 4
00904 #endif
00905 #ifndef ICMP_UNREACH_SRCFAIL
00906 #define ICMP_UNREACH_SRCFAIL 5
00907 #endif
00908 #ifndef ICMP_UNREACH_NET_UNKNOWN
00909 #define ICMP_UNREACH_NET_UNKNOWN 6
00910 #endif
00911 #ifndef ICMP_UNREACH_HOST_UNKNOWN
00912 #define ICMP_UNREACH_HOST_UNKNOWN 7
00913 #endif
00914 #ifndef ICMP_UNREACH_ISOLATED
00915 #define ICMP_UNREACH_ISOLATED 8
00916 #endif
00917 #ifndef ICMP_UNREACH_NET_PROHIB
00918 #define ICMP_UNREACH_NET_PROHIB 9
00919 #endif
00920 #ifndef ICMP_UNREACH_HOST_PROHIB
00921 #define ICMP_UNREACH_HOST_PROHIB 10
00922 #endif
00923 #ifndef ICMP_UNREACH_TOSNET
00924 #define ICMP_UNREACH_TOSNET 11
00925 #endif
00926 #ifndef ICMP_UNREACH_TOSHOST
00927 #define ICMP_UNREACH_TOSHOST 12
00928 #endif
00929 #ifndef ICMP_UNREACH_FILTER_PROHIB
00930 #define ICMP_UNREACH_FILTER_PROHIB 13
00931 #endif
00932 #ifndef ICMP_UNREACH_HOST_PRECEDENCE
00933 #define ICMP_UNREACH_HOST_PRECEDENCE 14
00934 #endif
00935 #ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
00936 #define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
00937 #endif
00938 #ifndef ICMP_REDIRECT_NET
00939 #define ICMP_REDIRECT_NET 0
00940 #endif
00941 #ifndef ICMP_REDIRECT_HOST
00942 #define ICMP_REDIRECT_HOST 1
00943 #endif
00944 #ifndef ICMP_REDIRECT_TOSNET
00945 #define ICMP_REDIRECT_TOSNET 2
00946 #endif
00947 #ifndef ICMP_REDIRECT_TOSHOST
00948 #define ICMP_REDIRECT_TOSHOST 3
00949 #endif
00950 #ifndef ICMP_TIMXCEED_INTRANS
00951 #define ICMP_TIMXCEED_INTRANS 0
00952 #endif
00953 #ifndef ICMP_TIMXCEED_REASS
00954 #define ICMP_TIMXCEED_REASS 1
00955 #endif
00956 #ifndef ICMP_PARAMPROB_OPTABSENT
00957 #define ICMP_PARAMPROB_OPTABSENT 1
00958 #endif
00959
00960 u_int16_t icmp_sum;
00961
00962 union
00963 {
00964 struct
00965 {
00966 u_int16_t id;
00967 u_int16_t seq;
00968 } echo;
00969
00970 #undef icmp_id
00971 #undef icmp_seq
00972 #define icmp_id hun.echo.id
00973 #define icmp_seq hun.echo.seq
00974
00975 u_int32_t gateway;
00976 struct
00977 {
00978 u_int16_t pad;
00979 u_int16_t mtu;
00980 } frag;
00981 } hun;
00982 union
00983 {
00984 struct
00985 {
00986 n_time its_otime;
00987 n_time its_rtime;
00988 n_time its_ttime;
00989 } ts;
00990 struct
00991 {
00992 struct libnet_ipv4_hdr idi_ip;
00993
00994 } ip;
00995 u_int32_t mask;
00996 int8_t data[1];
00997
00998 #undef icmp_mask
00999 #define icmp_mask dun.mask
01000 #undef icmp_data
01001 #define icmp_data dun.data
01002
01003 #undef icmp_otime
01004 #define icmp_otime dun.ts.its_otime
01005 #undef icmp_rtime
01006 #define icmp_rtime dun.ts.its_rtime
01007 #undef icmp_ttime
01008 #define icmp_ttime dun.ts.its_ttime
01009 }dun;
01010 };
01011
01012
01013
01014
01015
01016
01017
01018 struct libnet_igmp_hdr
01019 {
01020 u_int8_t igmp_type;
01021 #ifndef IGMP_MEMBERSHIP_QUERY
01022 #define IGMP_MEMBERSHIP_QUERY 0x11
01023 #endif
01024 #ifndef IGMP_V1_MEMBERSHIP_REPORT
01025 #define IGMP_V1_MEMBERSHIP_REPORT 0x12
01026 #endif
01027 #ifndef IGMP_V2_MEMBERSHIP_REPORT
01028 #define IGMP_V2_MEMBERSHIP_REPORT 0x16
01029 #endif
01030 #ifndef IGMP_LEAVE_GROUP
01031 #define IGMP_LEAVE_GROUP 0x17
01032 #endif
01033 u_int8_t igmp_code;
01034 u_int16_t igmp_sum;
01035 struct in_addr igmp_group;
01036 };
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046 #ifndef IPPROTO_ESP
01047 #define IPPROTO_ESP 50
01048 #endif
01049 struct libnet_esp_hdr
01050 {
01051 u_int32_t esp_spi;
01052 u_int32_t esp_seq;
01053 u_int32_t esp_iv;
01054 };
01055
01056 struct libnet_esp_ftr
01057 {
01058 u_int8_t esp_pad_len;
01059 u_int8_t esp_nxt_hdr;
01060 int8_t *esp_auth;
01061 };
01062
01063 #ifndef IPPROTO_AH
01064 #define IPPROTO_AH 51
01065 #endif
01066 struct libnet_ah_hdr
01067 {
01068 u_int8_t ah_nxt_hdr;
01069 u_int8_t ah_len;
01070 u_int16_t ah_res;
01071 u_int32_t ah_spi;
01072 u_int32_t ah_seq;
01073 u_int32_t ah_auth;
01074 };
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086 #define LIBNET_PROTO_ISL 201
01087 struct libnet_isl_hdr
01088 {
01089 u_int8_t isl_dhost[5];
01090 #if (LIBNET_LIL_ENDIAN)
01091 u_int8_t isl_type:4,
01092 isl_user:4;
01093 #endif
01094 #if (LIBNET_BIG_ENDIAN)
01095 u_int8_t isl_user:4,
01096 isl_type:4;
01097 #endif
01098 u_int8_t isl_shost[6];
01099 u_int16_t isl_len;
01100 u_int8_t isl_snap[6];
01101 u_int16_t isl_vid;
01102 u_int16_t isl_index;
01103 u_int16_t isl_reserved;
01104
01105 };
01106
01107 #ifndef IPPROTO_OSPF
01108 #define IPPROTO_OSPF 89
01109 #endif
01110 #define IPPROTO_OSPF_LSA 890
01111 #define LIBNET_MODX 4102
01112
01113
01114
01115
01116
01117 #define LIBNET_OPT_EBIT 0x02
01118 #define LIBNET_OPT_MCBIT 0x04
01119 #define LIBNET_OPT_NPBIT 0x08
01120 #define LIBNET_OPT_EABIT 0x10
01121 #define LIBNET_OPT_DCBIT 0x20
01122
01123
01124
01125
01126
01127
01128
01129 struct libnet_mpls_hdr
01130 {
01131 u_int32_t mpls_les;
01132 #define LIBNET_MPLS_BOS_ON 1
01133 #define LIBNET_MPLS_BOS_OFF 0
01134 };
01135
01136
01137
01138
01139
01140
01141 struct libnet_ntp_hdr_l_fp
01142 {
01143 u_int32_t integer;
01144 u_int32_t fraction;
01145 };
01146
01147 struct libnet_ntp_hdr_s_fp
01148 {
01149 u_int16_t integer;
01150 u_int16_t fraction;
01151 };
01152
01153
01154 struct libnet_ntp_hdr
01155 {
01156 u_int8_t ntp_li_vn_mode;
01157 #define LIBNET_NTP_LI_NW 0x0
01158 #define LIBNET_NTP_LI_AS 0x1
01159 #define LIBNET_NTP_LI_DS 0x2
01160 #define LIBNET_NTP_LI_AC 0x3
01161
01162 #define LIBNET_NTP_VN_2 0x2
01163 #define LIBNET_NTP_VN_3 0x3
01164 #define LIBNET_NTP_VN_4 0x4
01165
01166 #define LIBNET_NTP_MODE_R 0x0
01167 #define LIBNET_NTP_MODE_A 0x1
01168 #define LIBNET_NTP_MODE_P 0x2
01169 #define LIBNET_NTP_MODE_C 0x3
01170 #define LIBNET_NTP_MODE_S 0x4
01171 #define LIBNET_NTP_MODE_B 0x5
01172 #define LIBNET_NTP_MODE_RC 0x6
01173 #define LIBNET_NTP_MODE_RP 0x7
01174 u_int8_t ntp_stratum;
01175 #define LIBNET_NTP_STRATUM_UNAVAIL 0x0
01176 #define LIBNET_NTP_STRATUM_PRIMARY 0x1
01177
01178
01179 u_int8_t ntp_poll;
01180 u_int8_t ntp_precision;
01181 struct libnet_ntp_hdr_s_fp ntp_delay;
01182 struct libnet_ntp_hdr_s_fp ntp_dispersion;
01183 u_int32_t ntp_reference_id;
01184 #define LIBNET_NTP_REF_LOCAL 0x4c4f434c
01185 #define LIBNET_NTP_REF_PPS 0x50505300
01186 #define LIBNET_NTP_REF_ACTS 0x41435453
01187 #define LIBNET_NTP_REF_USNO 0x55534e4f
01188 #define LIBNET_NTP_REF_PTB 0x50544200
01189 #define LIBNET_NTP_REF_TDF 0x54444600
01190 #define LIBNET_NTP_REF_DCF 0x44434600
01191 #define LIBNET_NTP_REF_MSF 0x4d534600
01192 #define LIBNET_NTP_REF_WWV 0x57575600
01193 #define LIBNET_NTP_REF_WWVB 0x57575642
01194 #define LIBNET_NTP_REF_WWVH 0x57575648
01195 #define LIBNET_NTP_REF_CHU 0x43485500
01196 #define LIBNET_NTP_REF_LORC 0x4c4f5243
01197 #define LIBNET_NTP_REF_OMEG 0x4f4d4547
01198 #define LIBNET_NTP_REF_GPS 0x47505300
01199 #define LIBNET_NTP_REF_GOES 0x474f4553
01200 struct libnet_ntp_hdr_l_fp ntp_ref_ts;
01201 struct libnet_ntp_hdr_l_fp ntp_orig_ts;
01202 struct libnet_ntp_hdr_l_fp ntp_rec_ts;
01203 struct libnet_ntp_hdr_l_fp ntp_xmt_ts;
01204 };
01205
01206
01207
01208
01209
01210
01211
01212 struct libnet_ospf_hdr
01213 {
01214 u_int8_t ospf_v;
01215 #define OSPFVERSION 2
01216 u_int8_t ospf_type;
01217 #define LIBNET_OSPF_UMD 0
01218 #define LIBNET_OSPF_HELLO 1
01219 #define LIBNET_OSPF_DBD 2
01220 #define LIBNET_OSPF_LSR 3
01221 #define LIBNET_OSPF_LSU 4
01222 #define LIBNET_OSPF_LSA 5
01223 u_int16_t ospf_len;
01224 struct in_addr ospf_rtr_id;
01225 struct in_addr ospf_area_id;
01226 u_int16_t ospf_cksum;
01227 u_int16_t ospf_auth_type;
01228 #define LIBNET_OSPF_AUTH_NULL 0
01229 #define LIBNET_OSPF_AUTH_SIMPLE 1
01230 #define LIBNET_OSPF_AUTH_MD5 2
01231 };
01232
01233
01234
01235
01236
01237
01238
01239 struct libnet_auth_hdr
01240 {
01241 u_int16_t ospf_auth_null;
01242 u_int8_t ospf_auth_keyid;
01243 u_int8_t ospf_auth_len;
01244 u_int ospf_auth_seq;
01245 };
01246
01247
01248
01249
01250
01251
01252
01253 struct libnet_ospf_hello_hdr
01254 {
01255 struct in_addr hello_nmask;
01256 u_int16_t hello_intrvl;
01257 u_int8_t hello_opts;
01258 u_int8_t hello_rtr_pri;
01259 u_int hello_dead_intvl;
01260 struct in_addr hello_des_rtr;
01261 struct in_addr hello_bkup_rtr;
01262 struct in_addr hello_nbr;
01263 };
01264
01265
01266
01267
01268
01269 struct libnet_dbd_hdr
01270 {
01271 u_int16_t dbd_mtu_len;
01272 u_int8_t dbd_opts;
01273 u_int8_t dbd_type;
01274 #define LIBNET_DBD_IBI 0x01
01275 #define LIBNET_DBD_MBIT 0x02
01276 #define LIBNET_DBD_MSBIT 0x04
01277 u_int dbd_seq;
01278 };
01279
01280
01281
01282
01283
01284 #define LIBNET_LS_TYPE_RTR 1
01285 #define LIBNET_LS_TYPE_NET 2
01286 #define LIBNET_LS_TYPE_IP 3
01287 #define LIBNET_LS_TYPE_ASBR 4
01288 #define LIBNET_LS_TYPE_ASEXT 5
01289
01290
01291
01292
01293
01294 struct libnet_lsr_hdr
01295 {
01296 u_int lsr_type;
01297 u_int lsr_lsid;
01298 struct in_addr lsr_adrtr;
01299 };
01300
01301
01302
01303
01304
01305 struct libnet_lsu_hdr
01306 {
01307 u_int lsu_num;
01308 };
01309
01310
01311
01312
01313
01314 struct libnet_lsa_hdr
01315 {
01316 u_int16_t lsa_age;
01317 u_int8_t lsa_opts;
01318 u_int8_t lsa_type;
01319 u_int lsa_id;
01320 struct in_addr lsa_adv;
01321 u_int lsa_seq;
01322 u_int16_t lsa_cksum;
01323 u_int16_t lsa_len;
01324 };
01325
01326
01327
01328
01329
01330
01331
01332
01333 struct libnet_rtr_lsa_hdr
01334 {
01335 u_int16_t rtr_flags;
01336 #define LIBNET_RTR_FLAGS_W 0x0100
01337 #define LIBNET_RTR_FLAGS_E 0x0200
01338 #define LIBNET_RTR_FLAGS_B 0x0400
01339 u_int16_t rtr_num;
01340 u_int rtr_link_id;
01341 #define LIBNET_LINK_ID_NBR_ID 1
01342 #define LIBNET_LINK_ID_IP_DES 2
01343 #define LIBNET_LINK_ID_SUB 3
01344 u_int rtr_link_data;
01345 u_int8_t rtr_type;
01346 #define LIBNET_RTR_TYPE_PTP 1
01347 #define LIBNET_RTR_TYPE_TRANS 2
01348 #define LIBNET_RTR_TYPE_STUB 3
01349 #define RTR_TYPE_VRTL 4
01350 u_int8_t rtr_tos_num;
01351 u_int16_t rtr_metric;
01352 };
01353
01354
01355
01356
01357
01358 struct libnet_net_lsa_hdr
01359 {
01360 struct in_addr net_nmask;
01361 u_int net_rtr_id;
01362 };
01363
01364
01365
01366
01367
01368 struct libnet_sum_lsa_hdr
01369 {
01370 struct in_addr sum_nmask;
01371 u_int sum_metric;
01372 u_int sum_tos_metric;
01373 };
01374
01375
01376
01377
01378
01379
01380 struct libnet_as_lsa_hdr
01381 {
01382 struct in_addr as_nmask;
01383 u_int as_metric;
01384 #define LIBNET_AS_E_BIT_ON 0x80000000
01385 struct in_addr as_fwd_addr;
01386 u_int as_rte_tag;
01387 };
01388
01389
01390
01391
01392
01393
01394
01395 struct libnet_rip_hdr
01396 {
01397 u_int8_t rip_cmd;
01398 #define RIPCMD_REQUEST 1
01399 #define RIPCMD_RESPONSE 2
01400 #define RIPCMD_TRACEON 3
01401 #define RIPCMD_TRACEOFF 4
01402 #define RIPCMD_POLL 5
01403 #define RIPCMD_POLLENTRY 6
01404 #define RIPCMD_MAX 7
01405 u_int8_t rip_ver;
01406 #define RIPVER_0 0
01407 #define RIPVER_1 1
01408 #define RIPVER_2 2
01409 u_int16_t rip_rd;
01410 u_int16_t rip_af;
01411 u_int16_t rip_rt;
01412 u_int32_t rip_addr;
01413 u_int32_t rip_mask;
01414 u_int32_t rip_next_hop;
01415 u_int32_t rip_metric;
01416 };
01417
01418
01419
01420
01421
01422 #define LIBNET_RPC_CALL 0
01423 #define LIBNET_RPC_REPLY 1
01424 #define LIBNET_RPC_VERS 2
01425 #define LIBNET_RPC_LAST_FRAG 0x80000000
01426
01427
01428
01429
01430 #define LIBNET_PMAP_PROGRAM 100000
01431 #define LIBNET_PMAP_PROC_NULL 0
01432 #define LIBNET_PMAP_PROC_SET 1
01433 #define LIBNET_PMAP_PROC_UNSET 2
01434 #define LIBNET_PMAP_PROC_GETADDR 3
01435 #define LIBNET_PMAP_PROC_DUMP 4
01436 #define LIBNET_PMAP_PROC_CALLIT 5
01437 #define LIBNET_PMAP_PROC_BCAST 5
01438 #define LIBNET_PMAP_PROC_GETTIME 6
01439 #define LIBNET_PMAP_PROC_UADDR2TADDR 7
01440 #define LIBNET_PMAP_PROC_TADDR2UADDR 8
01441 #define LIBNET_PMAP_PROC_GETVERSADDR 9
01442 #define LIBNET_PMAP_PROC_INDIRECT 10
01443 #define LIBNET_PMAP_PROC_GETADDRLIST 11
01444 #define LIBNET_PMAP_PROC_GETSTAT 12
01445
01446
01447
01448 struct libnet_rpc_opaque_auth
01449 {
01450 u_int32_t rpc_auth_flavor;
01451 u_int32_t rpc_auth_length;
01452
01453 };
01454
01455 struct libnet_rpc_call
01456 {
01457 u_int32_t rpc_rpcvers;
01458 u_int32_t rpc_prognum;
01459 u_int32_t rpc_vers;
01460 u_int32_t rpc_procedure;
01461 struct libnet_rpc_opaque_auth rpc_credentials;
01462 struct libnet_rpc_opaque_auth rpc_verifier;
01463 };
01464
01465 struct libnet_rpc_call_hdr
01466 {
01467 u_int32_t rpc_xid;
01468 u_int32_t rpc_type;
01469 struct libnet_rpc_call rpc_call;
01470 };
01471
01472 struct libnet_rpc_call_tcp_hdr
01473 {
01474 u_int32_t rpc_record_marking;
01475 struct libnet_rpc_call_hdr rpc_common;
01476 };
01477
01478
01479
01480
01481
01482
01483 struct libnet_stp_conf_hdr
01484 {
01485 u_int16_t stp_id;
01486 u_int8_t stp_version;
01487 u_int8_t stp_bpdu_type;
01488 u_int8_t stp_flags;
01489 u_int8_t stp_rootid[8];
01490 u_int32_t stp_rootpc;
01491 u_int8_t stp_bridgeid[8];
01492 u_int16_t stp_portid;
01493 u_int16_t stp_mage;
01494 u_int16_t stp_maxage;
01495 u_int16_t stp_hellot;
01496 u_int16_t stp_fdelay;
01497 };
01498
01499
01500
01501
01502
01503
01504
01505 struct libnet_stp_tcn_hdr
01506 {
01507 u_int16_t stp_id;
01508 u_int8_t stp_version;
01509 u_int8_t stp_bpdu_type;
01510 };
01511
01512
01513
01514
01515
01516
01517
01518 struct libnet_tcp_hdr
01519 {
01520 u_int16_t th_sport;
01521 u_int16_t th_dport;
01522 u_int32_t th_seq;
01523 u_int32_t th_ack;
01524 #if (LIBNET_LIL_ENDIAN)
01525 u_int8_t th_x2:4,
01526 th_off:4;
01527 #endif
01528 #if (LIBNET_BIG_ENDIAN)
01529 u_int8_t th_off:4,
01530 th_x2:4;
01531 #endif
01532 u_int8_t th_flags;
01533 #ifndef TH_FIN
01534 #define TH_FIN 0x01
01535 #endif
01536 #ifndef TH_SYN
01537 #define TH_SYN 0x02
01538 #endif
01539 #ifndef TH_RST
01540 #define TH_RST 0x04
01541 #endif
01542 #ifndef TH_PUSH
01543 #define TH_PUSH 0x08
01544 #endif
01545 #ifndef TH_ACK
01546 #define TH_ACK 0x10
01547 #endif
01548 #ifndef TH_URG
01549 #define TH_URG 0x20
01550 #endif
01551 #ifndef TH_ECE
01552 #define TH_ECE 0x40
01553 #endif
01554 #ifndef TH_CWR
01555 #define TH_CWR 0x80
01556 #endif
01557 u_int16_t th_win;
01558 u_int16_t th_sum;
01559 u_int16_t th_urp;
01560 };
01561
01562
01563
01564
01565 struct libnet_token_ring_hdr
01566 {
01567 u_int8_t token_ring_access_control;
01568 #define LIBNET_TOKEN_RING_FRAME 0x10
01569 u_int8_t token_ring_frame_control;
01570 #define LIBNET_TOKEN_RING_LLC_FRAME 0x40
01571 u_int8_t token_ring_dhost[TOKEN_RING_ADDR_LEN];
01572 u_int8_t token_ring_shost[TOKEN_RING_ADDR_LEN];
01573 u_int8_t token_ring_llc_dsap;
01574 u_int8_t token_ring_llc_ssap;
01575 u_int8_t token_ring_llc_control_field;
01576 u_int8_t token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE];
01577 u_int16_t token_ring_type;
01578 #define TOKEN_RING_TYPE_IP 0x0800
01579 #define TOKEN_RING_TYPE_ARP 0x0806
01580 #define TOKEN_RING_TYPE_REVARP 0x8035
01581 };
01582
01583 struct libnet_token_ring_addr
01584 {
01585 u_int8_t token_ring_addr_octet[6];
01586 };
01587
01588
01589
01590
01591
01592
01593 struct libnet_udp_hdr
01594 {
01595 u_int16_t uh_sport;
01596 u_int16_t uh_dport;
01597 u_int16_t uh_ulen;
01598 u_int16_t uh_sum;
01599 };
01600
01601
01602
01603
01604
01605
01606
01607 #ifndef IPPROTO_VRRP
01608 #define IPPROTO_VRRP 112
01609 #endif
01610 struct libnet_vrrp_hdr
01611 {
01612 #if (LIBNET_LIL_ENDIAN)
01613 u_int8_t vrrp_v:4,
01614 vrrp_t:4;
01615 #endif
01616 #if (LIBNET_BIG_ENDIAN)
01617 u_int8_t vrrp_t:4,
01618 vrrp_v:4;
01619 #endif
01620 #define LIBNET_VRRP_VERSION_01 0x1
01621 #define LIBNET_VRRP_VERSION_02 0x2
01622 #define LIBNET_VRRP_TYPE_ADVERT 0x1
01623 u_int8_t vrrp_vrouter_id;
01624 u_int8_t vrrp_priority;
01625 u_int8_t vrrp_ip_count;
01626 u_int8_t vrrp_auth_type;
01627 #define LIBNET_VRRP_AUTH_NONE 0x1
01628 #define LIBNET_VRRP_AUTH_PASSWD 0x2
01629 #define LIBNET_VRRP_AUTH_IPAH 0x3
01630 u_int8_t vrrp_advert_int;
01631 u_int16_t vrrp_sum;
01632
01633
01634 };
01635
01636 #endif
01637
01638