Initial repo population
[ric-app/mc.git] / src / sidecars / listener / mcl.h
1 // vim: ts=4 sw=4 noet:
2 /*
3  --------------------------------------------------------------------------------
4         Copyright (c) 2018-2019 AT&T Intellectual Property.
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10            http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17  --------------------------------------------------------------------------------
18
19 /*
20         Mnemonic:       mcl.h
21         Abstract:       Header file for the mc listener library.
22         Date:           22 August 2019
23         Author:         E. Scott Daniels
24         
25 */
26
27 #ifndef mcl_h
28 #define mcl_h
29
30 #include <rmr/rmr.h>
31 #include <rmr/rmr_symtab.h>
32
33 // ------- public constants and structs -------------------------------------------------
34
35 #define MCL_LEN_SIZE 8          // number of bytes the length has in both short and extended header
36 #define MCL_DELIM_SIZE  4       // number of bytes in extended header delimiter
37 #define MCL_TSTAMP_SIZE 16      // number of bytes in extended header timestamp
38 #define MCL_EXHDR_SIZE  (MCL_DELIM_SIZE+MCL_LEN_SIZE+MCL_TSTAMP_SIZE)   // total size of extended header
39
40 #define MCL_DELIM               "@MCL"          // delimeter to synch msgs in fifo
41
42 #define MCL_TSTAMP_OFF  (MCL_DELIM_SIZE+MCL_LEN_SIZE)                                   // offsets in header
43 #define MCL_LEN_OFF             MCL_DELIM_SIZE
44
45 #define MCL_NOWAIT      0       // do not wait for RMR route table to arrive
46 #define MCL_WAIT        1       // block reader start until RMR route table is initialised
47
48 //------------ prototypes --------------------------------------------------------------
49 extern void mcl_fifo_fanout( void* ctx, int report, int long_hdrs );
50 extern rmr_mbuf_t* mcl_get_msg( void* vctx, rmr_mbuf_t* msg, int timeout );
51 extern  void* mcl_mk_context( char* dir );
52 extern int mcl_fifo_read1( void* vctx, int mtype, char* ubuf, int ublen, int long_hdr );
53 extern int mcl_fifo_tsread1( void* vctx, int mtype, char* ubuf, int ublen, int long_hdr, char* timestamp );
54 extern int mcl_set_sigh( );
55 extern int mcl_start_listening( void* vctx, char* port, int wait4ready );
56
57 #endif