#define _uta_private_h
// if pmode is off we don't compile in some checks in hopes of speeding things up
-#ifndef PARINOID_CHECKS
-# define PARINOID_CHECKS 0
+#ifndef PARANOID_CHECKS
+# define PARANOID_CHECKS 0
#endif
#define RF_NOTIFIED 0x01 // notification made about river issue
#define RF_DROP 0x02 // this message is large and being dropped
+#define TP_SZFIELD_LEN ((sizeof(uint32_t)*2)+1) // number of bytes needed for msg size in transport header
+#define TP_SZ_MARKER '$' // marker indicating net byte order used
+
+
#define SI_MAX_ADDR_LEN 512
+#define MAX_RIVERS 1024 // max number of directly mapped rivers
/*
Manages a river of inbound bytes.
Callback context.
typedef struct {
uta_ctx_t* ctx;
-
+
} cbctx_t;
*/
int shutdown; // thread notification if we need to tell them to stop
int max_mlen; // max message length payload+header
int max_plen; // max payload length
- int flags; // CTXFL_ constants
+ int flags; // CFL_ constants
int nrtele; // number of elements in the routing table
int send_retries; // number of retries send_msg() should attempt if eagain/timeout indicated by nng
int trace_data_len; // number of bytes to allocate in header for trace data
int d1_len; // extra header data 1 length
int d2_len; // extra header data 2 length (future)
int nn_sock; // our general listen socket
+ int rtable_ready; // set to true when rt is received or loaded
+ int snarf_rt_fd; // the file des where we save the last rt from RM
+ int dcount; // drop counter when app is slow
+ char* seed_rt_fname; // the static/seed route table; name captured at start
route_table_t* rtable; // the active route table
route_table_t* old_rtable; // the previously used rt, sits here to allow for draining
route_table_t* new_rtable; // route table under construction
pthread_t rtc_th; // thread info for the rtc listener
pthread_t mtc_th; // thread info for the multi-thread call receive process
+ // added for route manager request/states
+ rmr_whid_t rtg_whid; // wormhole id to the route manager for acks/requests
+ char* table_id; // table ID of the route table load in progress
+
// added for SI95 support
si_ctx_t* si_ctx; // the socket context
int nrivers; // allocated rivers
river_t* rivers; // inbound flows (index is the socket fd)
+ void* river_hash; // flows with fd values > nrivers must be mapped through the hash
int max_ibm; // max size of an inbound message (river accum alloc size)
void* zcb_mring; // zero copy buffer mbuf ring
- void* fd2ep; // the symtab mapping file des to endpoints for cleanup on disconnect
+ void* fd2ep; // the symtab mapping file des to endpoints for cleanup on disconnect
+ void* ephash; // hash host:port or ip:port to endpoint struct
+
+ pthread_mutex_t *fd2ep_gate; // we must gate add/deletes to the fd2 symtab
+ pthread_mutex_t *rtgate; // master gate for accessing/moving route tables
};
typedef uta_ctx_t uta_ctx;
// --- rt table things ---------------------------
static void uta_ep_failed( endpoint_t* ep );
-static int uta_link2( si_ctx_t* si_ctx, endpoint_t* ep );
+static int uta_link2( uta_ctx_t *ctx, endpoint_t* ep );
+
static int rt_link2_ep( void* vctx, endpoint_t* ep );
static rtable_ent_t* uta_get_rte( route_table_t *rt, int sid, int mtype, int try_alt );
static inline int xlate_si_state( int state, int def_state );
static void ref_tpbuf( rmr_mbuf_t* msg, size_t alen ) ;
static inline rmr_mbuf_t* clone_msg( rmr_mbuf_t* old_msg );
static rmr_mbuf_t* rcv_msg( uta_ctx_t* ctx, rmr_mbuf_t* old_msg );
-static void* rcv_payload( uta_ctx_t* ctx, rmr_mbuf_t* old_msg );
static inline rmr_mbuf_t* realloc_msg( rmr_mbuf_t* old_msg, int tr_len );
static rmr_mbuf_t* send2ep( uta_ctx_t* ctx, endpoint_t* ep, rmr_mbuf_t* msg );
static void fd2ep_init( uta_ctx_t* ctx );
static void fd2ep_add( uta_ctx_t* ctx, int fd, endpoint_t* ep );
+// ------ misc ---------------------------------------------------
+static inline void incr_ep_counts( int state, endpoint_t* ep ); // must declare for static includes, but after headers
+
#endif