CI: Add silent cmake SonarCloud scan
[ric-plt/lib/rmr.git] / test / rtg_sim / req_resp.h
1 // :vi ts=4 sw=4 noet:
2 /*
3 ==================================================================================
4         Copyright (c) 2019 Nokia
5         Copyright (c) 2018-2019 AT&T Intellectual Property.
6
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
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
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 ==================================================================================
19 */
20
21 #ifndef _req_resp_h
22 #define _req_resp_h
23
24 /*
25         A message buffer that can be used for either req/resp context setup
26         or for publishing in a pub/sub setup.
27 */
28 typedef struct rr_mbuf {
29         int     used;                   // bytes actually used
30         int size;                       // allocated size of payload
31         char*   payload;
32 } rr_mbuf_t;
33
34
35 /*
36         A 'context' to interface with nano; so far very simple, but could
37         expand, so we use the struct.
38 */
39 typedef struct rr_ctx {
40         int     nn_sock;
41 } rr_ctx_t;
42
43
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.
47
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 );
59
60 #endif