/********************************************************************************************************************************/ /* Created: 23-Oct-2009 14:59:26 by OpenVMS SDL EV2-3 */ /* Source: 23-OCT-2009 14:59:23 $6$DKC600:[000000.REDIR2]RDRDEF.SDL;1 */ /********************************************************************************************************************************/ /*** MODULE RDRDEF IDENT RDRDEF-1-X ***/ #ifndef __RDRDEF_LOADED #define __RDRDEF_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: TCP traffic redirector */ /* */ /* Abstract: This is an interface module contains constants and data structure */ /* declaration used by the TCP Redirector routines. */ /* */ /* Author: Ruslan R. Laishev */ /* */ /* Creation Date: 12-OCT-2009 */ /* */ /* Modification History: */ /* */ /*-- */ #define TCP$BASE_PORT 2048 #define RDR$MAX_SLOT 2048 /* */ /* */ /* */ #ifdef __cplusplus /* Define structure prototypes */ struct _que; #endif /* #ifdef __cplusplus */ #ifdef __NEW_STARLET typedef struct _rdr_que { struct _que *que$a_flink; struct _que *que$a_blink; } RDR_QUE; #else /* __OLD_STARLET */ struct rdr_que { void *que$a_flink; void *que$a_blink; } ; #endif /* #ifdef __NEW_STARLET */ /* */ /* A slot in translation table */ /* */ #define ENT$M_USED 0x1 #define ENT$K_SZ 24 #ifdef __NEW_STARLET typedef struct _rdr_ent { RDR_QUE ent$r_links; __union { unsigned int ent$l_flags; __struct { unsigned ent$v_used : 1; /* A lock */ unsigned ent$v_fill_2_ : 7; } ent$r_fill_1_; } ent$r_fill_0_; unsigned short int ent$w_idx; unsigned short int ent$w_spn; /* Save oroginal source port */ IP4_ADDR ent$r_src; /* Saved original source IP */ IP4_ADDR ent$r_dst; /* Save original destination IP */ } RDR_ENT; #if !defined(__VAXC) #define ent$l_flags ent$r_fill_0_.ent$l_flags #define ent$v_used ent$r_fill_0_.ent$r_fill_1_.ent$v_used #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct rdr_ent { struct rdr_que ent$r_links; __union { unsigned int ent$l_flags; __struct { unsigned ent$v_used : 1; /* A lock */ unsigned ent$v_fill_2_ : 7; } ent$r_fill_1_; } ent$r_fill_0_; unsigned short int ent$w_idx; unsigned short int ent$w_spn; /* Save oroginal source port */ union ip4_addr ent$r_src; /* Saved original source IP */ union ip4_addr ent$r_dst; /* Save original destination IP */ } ; #if !defined(__VAXC) #define ent$l_flags ent$r_fill_0_.ent$l_flags #define ent$v_used ent$r_fill_0_.ent$r_fill_1_.ent$v_used #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ /* */ /* Confuguration vector */ /* */ #ifdef __NEW_STARLET typedef struct _rdr_vec { unsigned int vec$l_scount; /* A size of the slot table */ RDR_ENT vec$r_slot [2048]; IP4_ADDR vec$r_tip; /* Tagret IP address */ unsigned short int vec$w_tpn; /* Target TCP port number */ unsigned short int vec$w_count; /* Count of sources */ /* An array of sources */ __struct { IP4_ADDR vec$r_netw [2]; IP4_ADDR vec$r_mask [2]; } vec$r_src; RDR_QUE vec$r_qfree; RDR_QUE vec$r_qbusy; } RDR_VEC; #if !defined(__VAXC) #define vec$r_netw vec$r_src.vec$r_netw #define vec$r_mask vec$r_src.vec$r_mask #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct rdr_vec { unsigned int vec$l_scount; /* A size of the slot table */ struct rdr_ent vec$r_slot [2048]; union ip4_addr vec$r_tip; /* Tagret IP address */ unsigned short int vec$w_tpn; /* Target TCP port number */ unsigned short int vec$w_count; /* Count of sources */ /* An array of sources */ __struct { union ip4_addr vec$r_netw [2]; union ip4_addr vec$r_mask [2]; } vec$r_src; struct rdr_que vec$r_qfree; struct rdr_que vec$r_qbusy; } ; #if !defined(__VAXC) #define vec$r_netw vec$r_src.vec$r_netw #define vec$r_mask vec$r_src.vec$r_mask #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ /* */ /* Network connection context */ /* */ #ifdef __NEW_STARLET typedef struct _nctx_nctx { RDR_QUE nctx$r_node; /* Tree's node stuff */ RDR_QUE nctx$r_link; /* Free/busy queue link */ unsigned short int nctx$w_proto; /* Protocol code: TCP/UDP ... */ unsigned short int nctx$w_state; /* Socket states */ unsigned int nctx$l_inseq; unsigned int nctx$l_outseq; unsigned int nctx$l_inack; unsigned int nctx$l_outack; } NCTX_NCTX; #else /* __OLD_STARLET */ struct nctx_nctx { struct rdr_que nctx$r_node; /* Tree's node stuff */ struct rdr_que nctx$r_link; /* Free/busy queue link */ unsigned short int nctx$w_proto; /* Protocol code: TCP/UDP ... */ unsigned short int nctx$w_state; /* Socket states */ unsigned int nctx$l_inseq; unsigned int nctx$l_outseq; unsigned int nctx$l_inack; unsigned int nctx$l_outack; } ; #endif /* #ifdef __NEW_STARLET */ /* */ /* Sense Mode P1 Characteristics Buffer */ /* */ #ifdef __NEW_STARLET typedef struct _nma_char { unsigned short int nma$w_mms; /* Maximum Message Size */ unsigned char nma$b_type; /* Type */ unsigned char nma$b_class; /* Class */ unsigned char nma$b_na; unsigned char nma$b_error; /* Error Summary */ unsigned char nma$b_sts; /* Status */ unsigned char nma$b_na2; } NMA_CHAR; #else /* __OLD_STARLET */ struct nma_char { unsigned short int nma$w_mms; /* Maximum Message Size */ unsigned char nma$b_type; /* Type */ unsigned char nma$b_class; /* Class */ unsigned char nma$b_na; unsigned char nma$b_error; /* Error Summary */ unsigned char nma$b_sts; /* Status */ unsigned char nma$b_na2; } ; #endif /* #ifdef __NEW_STARLET */ /* */ /* Sense Mode Attribute Buffer */ /* */ #define NMA$K_STRSZ 4 #define NMA$K_LWSZ 6 #ifdef __NEW_STARLET typedef struct _nma_attr { unsigned nma$v_pid : 12; /* Parameter ID */ unsigned nma$v_str : 1; /* Longword = 0 or String = 1 attribute */ unsigned nma$v_notused : 2; unsigned nma$v_mbz : 1; __union { unsigned int nma$l_prm; /* Longword of Value */ __struct { unsigned short int nma$w_bcnt; /* Word of String Count */ unsigned char nma$b_prm [1]; /* String */ } nma$r_fill_4_; } nma$r_fill_3_; } NMA_ATTR; #if !defined(__VAXC) #define nma$l_prm nma$r_fill_3_.nma$l_prm #define nma$w_bcnt nma$r_fill_3_.nma$r_fill_4_.nma$w_bcnt #define nma$b_prm nma$r_fill_3_.nma$r_fill_4_.nma$b_prm #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct nma_attr { unsigned nma$v_pid : 12; /* Parameter ID */ unsigned nma$v_str : 1; /* Longword = 0 or String = 1 attribute */ unsigned nma$v_notused : 2; unsigned nma$v_mbz : 1; __union { unsigned int nma$l_prm; /* Longword of Value */ __struct { unsigned short int nma$w_bcnt; /* Word of String Count */ unsigned char nma$b_prm [1]; /* String */ } nma$r_fill_4_; } nma$r_fill_3_; } ; #if !defined(__VAXC) #define nma$l_prm nma$r_fill_3_.nma$l_prm #define nma$w_bcnt nma$r_fill_3_.nma$r_fill_4_.nma$w_bcnt #define nma$b_prm nma$r_fill_3_.nma$r_fill_4_.nma$b_prm #endif /* #if !defined(__VAXC) */ #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 /* __RDRDEF_LOADED */