test(e2e): Add return to sender app based test
[ric-plt/lib/rmr.git] / src / nng / include / rmr_nng_private.h
index 83db500..6bca91f 100644 (file)
@@ -1,14 +1,14 @@
 // : vi ts=4 sw=4 noet :
 /*
 ==================================================================================
 // : vi ts=4 sw=4 noet :
 /*
 ==================================================================================
-       Copyright (c) 2019 Nokia 
+       Copyright (c) 2019 Nokia
        Copyright (c) 2018-2019 AT&T Intellectual Property.
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
        Copyright (c) 2018-2019 AT&T Intellectual Property.
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+          http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
@@ -49,14 +49,14 @@ struct endpoint {
        Epoll information needed for the rmr_torcv_msg() funciton
 */
 typedef struct epoll_stuff {
        Epoll information needed for the rmr_torcv_msg() funciton
 */
 typedef struct epoll_stuff {
-    struct epoll_event events[1];                              // wait on 10 possible events
-    struct epoll_event epe;                                            // event definition for event to listen to
+       struct epoll_event events[1];                           // wait on 10 possible events
+       struct epoll_event epe;                                         // event definition for event to listen to
        int ep_fd;                                                                      // file des from nng
        int nng_fd;                                                                     // fd from nng
 } epoll_stuff_t;
 
 /*
        int ep_fd;                                                                      // file des from nng
        int nng_fd;                                                                     // fd from nng
 } epoll_stuff_t;
 
 /*
-       Context describing our world. Should be returned to user programme on 
+       Context describing our world. Should be returned to user programme on
        call to initialise, and passed as first parm on all calls to other
        visible functions.
 
        call to initialise, and passed as first parm on all calls to other
        visible functions.
 
@@ -70,16 +70,19 @@ struct uta_ctx {
        int     flags;                                  // CTXFL_ 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     flags;                                  // CTXFL_ 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   (future)
+       int d2_len;                                     // extra header data 2 length   (future)
        nng_socket      nn_sock;                // our general listen socket
        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
        if_addrs_t*     ip_list;                // list manager of the IP addresses that are on our known interfaces
        void*   mring;                          // ring where msgs are queued while waiting for a call response msg
        nng_socket      nn_sock;                // our general listen socket
        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
        if_addrs_t*     ip_list;                // list manager of the IP addresses that are on our known interfaces
        void*   mring;                          // ring where msgs are queued while waiting for a call response msg
-       
+
        char*   rtg_addr;                       // addr/port of the route table generation publisher
        int             rtg_port;                       // the port that the rtg listens on
        char*   rtg_addr;                       // addr/port of the route table generation publisher
        int             rtg_port;                       // the port that the rtg listens on
-       
+
        wh_mgt_t*       wormholes;              // management of user opened wormholes
        epoll_stuff_t*  eps;            // epoll information needed for the rcv with timeout call
 
        wh_mgt_t*       wormholes;              // management of user opened wormholes
        epoll_stuff_t*  eps;            // epoll information needed for the rcv with timeout call
 
@@ -89,7 +92,7 @@ struct uta_ctx {
 
 
 /*
 
 
 /*
-       Static prototypes for functions located here. All common protos are in the 
+       Static prototypes for functions located here. All common protos are in the
        agnostic header file.
 */
 
        agnostic header file.
 */
 
@@ -101,17 +104,18 @@ static void free_ctx( uta_ctx_t* ctx );
 static int uta_link2( char* target, nng_socket* nn_sock, nng_dialer* dialer );
 static int rt_link2_ep( endpoint_t* ep );
 static int uta_epsock_byname( route_table_t* rt, char* ep_name, nng_socket* nn_sock );
 static int uta_link2( char* target, nng_socket* nn_sock, nng_dialer* dialer );
 static int rt_link2_ep( endpoint_t* ep );
 static int uta_epsock_byname( route_table_t* rt, char* ep_name, nng_socket* nn_sock );
-static int uta_epsock_rr( route_table_t *rt, int mtype, int group, int* more, nng_socket* nn_sock );
+static int uta_epsock_rr( route_table_t *rt, uint64_t key, int group, int* more, nng_socket* nn_sock );
 static inline int xlate_nng_state( int state, int def_state );
 
 
 // --- msg ---------------------------------------
 static inline int xlate_nng_state( int state, int def_state );
 
 
 // --- msg ---------------------------------------
-static rmr_mbuf_t* alloc_zcmsg( uta_ctx_t* ctx, rmr_mbuf_t* msg, int size, int state );
+static rmr_mbuf_t* alloc_zcmsg( uta_ctx_t* ctx, rmr_mbuf_t* msg, int size, int state, int trlo );
 static rmr_mbuf_t* alloc_mbuf( uta_ctx_t* ctx, int 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 rmr_mbuf_t* alloc_mbuf( uta_ctx_t* ctx, int 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* send_msg( uta_ctx_t* ctx, rmr_mbuf_t* msg, nng_socket nn_sock, int retries );
 static rmr_mbuf_t* send2ep( uta_ctx_t* ctx, endpoint_t* ep, rmr_mbuf_t* msg );
 
 static rmr_mbuf_t* send_msg( uta_ctx_t* ctx, rmr_mbuf_t* msg, nng_socket nn_sock, int retries );
 static rmr_mbuf_t* send2ep( uta_ctx_t* ctx, endpoint_t* ep, rmr_mbuf_t* msg );