1 // : vi ts=4 sw=4 noet :
3 ==================================================================================
4 Copyright (c) 2019-2020 Nokia
5 Copyright (c) 2018-2020 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 ==================================================================================
22 Mnemonic: rtc_si_static.c
23 Abstract: This is a test module to allow the route table to be read
24 from a static spot and NOT to attempt to listen for updates
25 from some outside source.
27 Author: E. Scott Daniels
31 #ifndef _rtc_si_staic_c
32 #define _rtc_si_staic_c
41 #include <sys/types.h>
46 Loop forever (assuming we're running in a pthread reading the static table
49 static void* rtc_file( void* vctx ) {
50 uta_ctx_t* ctx; // context user has -- where we pin the route table
52 int vfd = -1; // verbose file des if we have one
53 int vlevel = 0; // how chatty we should be 0== no nattering allowed
57 if( (ctx = (uta_ctx_t *) vctx) == NULL ) {
58 fprintf( stderr, "[CRI] rmr_rtc: internal mishap: context passed in was nil\n" );
62 if( (eptr = getenv( ENV_VERBOSE_FILE )) != NULL ) {
63 vfd = open( eptr, O_RDONLY );
70 read( vfd, wbuf, 10 );
71 vlevel = atoi( wbuf );
74 read_static_rt( ctx, vlevel ); // seed the route table if one provided