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