3 ==================================================================================
4 Copyright (c) 2019 Nokia
5 Copyright (c) 2018-2019 AT&T Intellectual Property.
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ==================================================================================
25 A message buffer that can be used for either req/resp context setup
26 or for publishing in a pub/sub setup.
28 typedef struct rr_mbuf {
29 int used; // bytes actually used
30 int size; // allocated size of payload
36 A 'context' to interface with nano; so far very simple, but could
37 expand, so we use the struct.
39 typedef struct rr_ctx {
44 // ---- prototypes for the rr library ----------------------
45 // vctx is the pointer returned by the connect or start listening functions
46 // and is passed to nearly all other functions.
48 extern void* rr_connect( char* host, char* port );
49 extern void* rr_start_listening( char* port );
50 extern rr_mbuf_t* rr_new_buffer( rr_mbuf_t* mb, int len );
51 extern void rr_close( void* vctx );
52 extern void rr_free( void* vctx );
53 extern void rr_free_mbuf( rr_mbuf_t* mbuf );
54 extern void* open_publisher( char* port );
55 extern int rr_rcv_to( void* vctx, int time );
56 extern int rr_send_to( void* vctx, int time );
57 extern rr_mbuf_t* rr_receive( void* vctx, rr_mbuf_t* mbuf, int len );
58 extern rr_mbuf_t* rr_send( void* vctx, rr_mbuf_t* mbuf, int alloc_buf );