/********************************************************************************************************************************/ /* Created: 23-Oct-2009 14:59:26 by OpenVMS SDL EV2-3 */ /* Source: 23-OCT-2009 14:59:22 $6$DKC600:[000000.REDIR2]IPDEF.SDL;1 */ /********************************************************************************************************************************/ /*** MODULE IPDEF IDENT IPDEF-1-X ***/ #ifndef __IPDEF_LOADED #define __IPDEF_LOADED 1 #pragma __nostandard /* This file uses non-ANSI-Standard features */ #pragma __member_alignment __save #pragma __nomember_alignment #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif #ifdef __cplusplus extern "C" { #define __unknown_params ... #define __optional_params ... #else #define __unknown_params #define __optional_params ... #endif #ifndef __struct #if !defined(__VAXC) #define __struct struct #else #define __struct variant_struct #endif #endif #ifndef __union #if !defined(__VAXC) #define __union union #else #define __union variant_union #endif #endif /*++ */ /* */ /* Facility: Internet Protocol */ /* */ /* */ /* Abstract: */ /* */ /* Author: Ruslan R. Laishev */ /* */ /* Creation Date: 06-OCT-2009 */ /* */ /* Modification History: */ /* */ /*-- */ /* */ /* ASSIGNED INTERNET PROTOCOL NUMBERS */ /* */ #define IP$PROTO_ICMP 1 #define IP$PROTO_TCP 6 #define IP$PROTO_UDP 17 /* */ /* ASSIGNED PORT NUMBERS */ /* */ #define IP$PORT_TELNET 23 #define IP$PORT_HTTP 80 #define IP$PORT_HTTPS 443 #define IP$PORT_POP3 110 #define IP$PORT_POP3S 495 #define IP4$ADDR_BROAD -1 #ifdef __NEW_STARLET typedef union _ip4_addr { unsigned char ip4$b_addr [4]; __union { unsigned int ip4$l_addr; __struct { unsigned short int ip4$w_hi; unsigned short int ip4$w_lo; } ip4$r_fill_1_; } ip4$r_fill_0_; } IP4_ADDR; #if !defined(__VAXC) #define ip4$l_addr ip4$r_fill_0_.ip4$l_addr #define ip4$w_hi ip4$r_fill_0_.ip4$r_fill_1_.ip4$w_hi #define ip4$w_lo ip4$r_fill_0_.ip4$r_fill_1_.ip4$w_lo #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ union ip4_addr { unsigned char ip4$b_addr [4]; __union { unsigned int ip4$l_addr; __struct { unsigned short int ip4$w_hi; unsigned short int ip4$w_lo; } ip4$r_fill_1_; } ip4$r_fill_0_; } ; #if !defined(__VAXC) #define ip4$l_addr ip4$r_fill_0_.ip4$l_addr #define ip4$w_hi ip4$r_fill_0_.ip4$r_fill_1_.ip4$w_hi #define ip4$w_lo ip4$r_fill_0_.ip4$r_fill_1_.ip4$w_lo #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ /* */ /* TCP connection states ( Normal states for server) */ /* */ #define ARP$K_CLOSED 1 #define ARP$K_LISTEN 2 #define ARP$K_SYN_RCVD 3 #define ARP$K_SYN_SENT 4 #define ARP$K_ESTABLISHED 5 #define ARP$K_CLOSE_WAIT 6 #define ARP$K_LAST_ACK 7 /* */ /* TCP header structure */ /* */ #define TCP$M_FILL 0xF #define TCP$M_HLEN 0xF0 #define TCP$M_FIN 0x1 #define TCP$M_SYN 0x2 #define TCP$M_RST 0x4 #define TCP$M_PSH 0x8 #define TCP$M_ACK 0x10 #define TCP$M_URG 0x20 #define TCP$K_SZ 20 #ifdef __NEW_STARLET typedef struct _tcp_seg { unsigned short int tcp$w_spn; unsigned short int tcp$w_dpn; unsigned int tcp$l_seq; unsigned int tcp$l_ack; __union { unsigned char tcp$b_hlen; __struct { unsigned tcp$v_fill : 4; unsigned tcp$v_hlen : 4; } tcp$r_fill_3_; } tcp$r_fill_2_; __union { unsigned char tcp$b_ctl; __struct { unsigned tcp$v_fin : 1; unsigned tcp$v_syn : 1; unsigned tcp$v_rst : 1; unsigned tcp$v_psh : 1; unsigned tcp$v_ack : 1; unsigned tcp$v_urg : 1; unsigned tcp$v_fill : 2; } tcp$r_fill_5_; } tcp$r_fill_4_; unsigned short int tcp$w_winsz; unsigned short int tcp$w_csum; unsigned short int tcp$w_urgp; __union { unsigned int tcp$l_opts [1]; unsigned char tcp$b_data [1]; } tcp$r__u1; } TCP_SEG; #if !defined(__VAXC) #define tcp$b_hlen tcp$r_fill_2_.tcp$b_hlen #define tcp$v_fill tcp$r_fill_2_.tcp$r_fill_3_.tcp$v_fill #define tcp$v_hlen tcp$r_fill_2_.tcp$r_fill_3_.tcp$v_hlen #define tcp$b_ctl tcp$r_fill_4_.tcp$b_ctl #define tcp$v_fin tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_fin #define tcp$v_syn tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_syn #define tcp$v_rst tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_rst #define tcp$v_psh tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_psh #define tcp$v_ack tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_ack #define tcp$v_urg tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_urg #define tcp$l_opts tcp$r__u1.tcp$l_opts #define tcp$b_data tcp$r__u1.tcp$b_data #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct tcp_seg { unsigned short int tcp$w_spn; unsigned short int tcp$w_dpn; unsigned int tcp$l_seq; unsigned int tcp$l_ack; __union { unsigned char tcp$b_hlen; __struct { unsigned tcp$v_fill : 4; unsigned tcp$v_hlen : 4; } tcp$r_fill_3_; } tcp$r_fill_2_; __union { unsigned char tcp$b_ctl; __struct { unsigned tcp$v_fin : 1; unsigned tcp$v_syn : 1; unsigned tcp$v_rst : 1; unsigned tcp$v_psh : 1; unsigned tcp$v_ack : 1; unsigned tcp$v_urg : 1; unsigned tcp$v_fill : 2; } tcp$r_fill_5_; } tcp$r_fill_4_; unsigned short int tcp$w_winsz; unsigned short int tcp$w_csum; unsigned short int tcp$w_urgp; __union { unsigned int tcp$l_opts [1]; unsigned char tcp$b_data [1]; } tcp$r__u1; } ; #if !defined(__VAXC) #define tcp$b_hlen tcp$r_fill_2_.tcp$b_hlen #define tcp$v_fill tcp$r_fill_2_.tcp$r_fill_3_.tcp$v_fill #define tcp$v_hlen tcp$r_fill_2_.tcp$r_fill_3_.tcp$v_hlen #define tcp$b_ctl tcp$r_fill_4_.tcp$b_ctl #define tcp$v_fin tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_fin #define tcp$v_syn tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_syn #define tcp$v_rst tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_rst #define tcp$v_psh tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_psh #define tcp$v_ack tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_ack #define tcp$v_urg tcp$r_fill_4_.tcp$r_fill_5_.tcp$v_urg #define tcp$l_opts tcp$r__u1.tcp$l_opts #define tcp$b_data tcp$r__u1.tcp$b_data #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ #ifdef __NEW_STARLET typedef struct _udp_dgram { unsigned short int udp$w_spn; unsigned short int udp$w_dpn; unsigned short int udp$w_len; unsigned short int udp$w_csum; unsigned char udp$b_data [1]; } UDP_DGRAM; #else /* __OLD_STARLET */ struct udp_dgram { unsigned short int udp$w_spn; unsigned short int udp$w_dpn; unsigned short int udp$w_len; unsigned short int udp$w_csum; unsigned char udp$b_data [1]; } ; #endif /* #ifdef __NEW_STARLET */ #define IP$M_HLEN 0xF #define IP$M_VER 0xF0 #define IP$VER_IP4 4 #define IP$VER_IP6 6 #define IP$TOS_NODELAY 8 #define IP$TOS_THRPT 4 #define IP$TOS_REL 2 #define IP$TOS_NOCOST 1 #define IP$TOS_NORM 1 #define IP$M_PRECEDENCE 0x7 #define IP$M_TOS 0x78 #define IP$M_MF 0x1 #define IP$M_DF 0x2 #define IP$K_SZ 20 #ifdef __NEW_STARLET typedef struct _ip_dgram { __union { unsigned char ip$b__s; __struct { unsigned ip$v_hlen : 4; unsigned ip$v_ver : 4; } ip$r_fill_7_; } ip$r_fill_6_; __union { unsigned char ip$b_tos; __struct { unsigned ip$v_precedence : 3; unsigned ip$v_tos : 4; unsigned ip$v_mbz : 1; } ip$r_fill_9_; } ip$r_fill_8_; unsigned short int ip$w_len; unsigned short int ip$w_id; __union { unsigned short int ip$w_flags; __struct { unsigned ip$v_mf : 1; /* Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments. */ unsigned ip$v_df : 1; /* Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment. */ unsigned ip$v_mbz : 1; /* Bit 0: reserved, must be zero */ unsigned ip$v_off : 13; } ip$r_fill_11_; } ip$r_fill_10_; unsigned char ip$b_ttl; unsigned char ip$b_proto; unsigned short int ip$w_csum; IP4_ADDR ip$r_src; IP4_ADDR ip$r_dst; __union { unsigned int ip$l_opts [1]; unsigned char ip$b_data [1]; TCP_SEG ip$r_seg; UDP_DGRAM ip$r_dgram; } ip$r__u1; } IP_DGRAM; #if !defined(__VAXC) #define ip$v_hlen ip$r_fill_6_.ip$r_fill_7_.ip$v_hlen #define ip$v_ver ip$r_fill_6_.ip$r_fill_7_.ip$v_ver #define ip$b_tos ip$r_fill_8_.ip$b_tos #define ip$v_precedence ip$r_fill_8_.ip$r_fill_9_.ip$v_precedence #define ip$v_tos ip$r_fill_8_.ip$r_fill_9_.ip$v_tos #define ip$w_flags ip$r_fill_10_.ip$w_flags #define ip$v_mf ip$r_fill_10_.ip$r_fill_11_.ip$v_mf #define ip$v_df ip$r_fill_10_.ip$r_fill_11_.ip$v_df #define ip$v_off ip$r_fill_10_.ip$r_fill_11_.ip$v_off #define ip$l_opts ip$r__u1.ip$l_opts #define ip$b_data ip$r__u1.ip$b_data #define ip$r_seg ip$r__u1.ip$r_seg #define ip$r_dgram ip$r__u1.ip$r_dgram #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct ip_dgram { __union { unsigned char ip$b__s; __struct { unsigned ip$v_hlen : 4; unsigned ip$v_ver : 4; } ip$r_fill_7_; } ip$r_fill_6_; __union { unsigned char ip$b_tos; __struct { unsigned ip$v_precedence : 3; unsigned ip$v_tos : 4; unsigned ip$v_mbz : 1; } ip$r_fill_9_; } ip$r_fill_8_; unsigned short int ip$w_len; unsigned short int ip$w_id; __union { unsigned short int ip$w_flags; __struct { unsigned ip$v_mf : 1; /* Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments. */ unsigned ip$v_df : 1; /* Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment. */ unsigned ip$v_mbz : 1; /* Bit 0: reserved, must be zero */ unsigned ip$v_off : 13; } ip$r_fill_11_; } ip$r_fill_10_; unsigned char ip$b_ttl; unsigned char ip$b_proto; unsigned short int ip$w_csum; union ip4_addr ip$r_src; union ip4_addr ip$r_dst; __union { unsigned int ip$l_opts [1]; unsigned char ip$b_data [1]; struct tcp_seg ip$r_seg; struct udp_dgram ip$r_dgram; } ip$r__u1; } ; #if !defined(__VAXC) #define ip$v_hlen ip$r_fill_6_.ip$r_fill_7_.ip$v_hlen #define ip$v_ver ip$r_fill_6_.ip$r_fill_7_.ip$v_ver #define ip$b_tos ip$r_fill_8_.ip$b_tos #define ip$v_precedence ip$r_fill_8_.ip$r_fill_9_.ip$v_precedence #define ip$v_tos ip$r_fill_8_.ip$r_fill_9_.ip$v_tos #define ip$w_flags ip$r_fill_10_.ip$w_flags #define ip$v_mf ip$r_fill_10_.ip$r_fill_11_.ip$v_mf #define ip$v_df ip$r_fill_10_.ip$r_fill_11_.ip$v_df #define ip$v_off ip$r_fill_10_.ip$r_fill_11_.ip$v_off #define ip$l_opts ip$r__u1.ip$l_opts #define ip$b_data ip$r__u1.ip$b_data #define ip$r_seg ip$r__u1.ip$r_seg #define ip$r_dgram ip$r__u1.ip$r_dgram #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ /* */ /* Ethernet's Media Access Control */ /* */ #define ETH$M_GRP 0x1 #define ETH$M_UNIV 0x2 #define ETH$M_VENDOR 0xFFFFFC #define ETH$M_INUM 0xFFFFFF000000 #define ETH$K_MACSZ 6 #ifdef __NEW_STARLET typedef union _eth_mac { __union { unsigned char eth$b_mac [6]; __struct { unsigned eth$v_grp : 1; unsigned eth$v_univ : 1; unsigned eth$v_vendor : 22; unsigned eth$v_inum : 24; } eth$r_fill_13_; } eth$r_fill_12_; } ETH_MAC; #if !defined(__VAXC) #define eth$b_mac eth$r_fill_12_.eth$b_mac #define eth$v_grp eth$r_fill_12_.eth$r_fill_13_.eth$v_grp #define eth$v_univ eth$r_fill_12_.eth$r_fill_13_.eth$v_univ #define eth$v_vendor eth$r_fill_12_.eth$r_fill_13_.eth$v_vendor #define eth$v_inum eth$r_fill_12_.eth$r_fill_13_.eth$v_inum #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ union eth_mac { __union { unsigned char eth$b_mac [6]; __struct { unsigned eth$v_grp : 1; unsigned eth$v_univ : 1; unsigned eth$v_vendor : 22; unsigned eth$v_inum : 24; } eth$r_fill_13_; } eth$r_fill_12_; } ; #if !defined(__VAXC) #define eth$b_mac eth$r_fill_12_.eth$b_mac #define eth$v_grp eth$r_fill_12_.eth$r_fill_13_.eth$v_grp #define eth$v_univ eth$r_fill_12_.eth$r_fill_13_.eth$v_univ #define eth$v_vendor eth$r_fill_12_.eth$r_fill_13_.eth$v_vendor #define eth$v_inum eth$r_fill_12_.eth$r_fill_13_.eth$v_inum #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ /* */ /* ASSIGNED INTERNET PROTOCOL NUMBERS */ /* */ #define PTY$K_IP 2048 #define PTY$K_ARP 2054 #define PTY$K_RARP 2101 /* */ /* Classical Ethernet II frame format */ /* */ #define ETH2$K_HDRSZ 14 #ifdef __NEW_STARLET typedef struct _hdr_eth2 { ETH_MAC eth2$r_da; /* Destination Address */ ETH_MAC eth2$r_sa; /* Source Address */ unsigned short int eth2$w_pty; /* Ethernet Protocol Type */ unsigned char eth2$b_data [1]; /* User's data (can include 2byte length field) */ unsigned int eth2$l_crc; /* Cyclic Redundancy Check */ } HDR_ETH2; #else /* __OLD_STARLET */ struct hdr_eth2 { union eth_mac eth2$r_da; /* Destination Address */ union eth_mac eth2$r_sa; /* Source Address */ unsigned short int eth2$w_pty; /* Ethernet Protocol Type */ unsigned char eth2$b_data [1]; /* User's data (can include 2byte length field) */ unsigned int eth2$l_crc; /* Cyclic Redundancy Check */ } ; #endif /* #ifdef __NEW_STARLET */ /* */ /* IP ARP Datagram */ /* */ #define ARP$K_REQUEST 1 #define ARP$K_REPLY 2 #ifdef __NEW_STARLET typedef struct _arp_pdu { unsigned short int arp$w_hrd; /* Hardware address space (e.g., Ethernet, */ /* Packet Radio Net.) */ unsigned short int arp$w_proto; /* Protocol address space. For Ethernet */ /* hardware, this is from the set of type */ /* fields ether_typ$. */ unsigned char arp$b_hln; /* byte length of each hardware address */ unsigned char arp$b_pln; /* byte length of each protocol address */ unsigned short int arp$w_op; /* opcode (ares_op$REQUEST | ares_op$REPLY) */ ETH_MAC arp$r_sha; IP4_ADDR arp$r_spa; ETH_MAC arp$r_tha; IP4_ADDR arp$r_tpa; } ARP_PDU; #else /* __OLD_STARLET */ struct arp_pdu { unsigned short int arp$w_hrd; /* Hardware address space (e.g., Ethernet, */ /* Packet Radio Net.) */ unsigned short int arp$w_proto; /* Protocol address space. For Ethernet */ /* hardware, this is from the set of type */ /* fields ether_typ$. */ unsigned char arp$b_hln; /* byte length of each hardware address */ unsigned char arp$b_pln; /* byte length of each protocol address */ unsigned short int arp$w_op; /* opcode (ares_op$REQUEST | ares_op$REPLY) */ union eth_mac arp$r_sha; union ip4_addr arp$r_spa; union eth_mac arp$r_tha; union ip4_addr arp$r_tpa; } ; #endif /* #ifdef __NEW_STARLET */ #pragma __member_alignment __restore #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __IPDEF_LOADED */