| // : vi ts=4 sw=4 noet : |
| /* |
| ================================================================================== |
| 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 |
| |
| 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, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| ================================================================================== |
| */ |
| |
| |
| /* |
| Mnemonic: tools_testh.c |
| Abstract: Unit tests for the RMr tools module. |
| Author: E. Scott Daniels |
| Date: 21 January 2019 |
| */ |
| |
| |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <netdb.h> |
| #include <errno.h> |
| #include <string.h> |
| #include <errno.h> |
| #include <pthread.h> |
| #include <ctype.h> |
| #include <pthread.h> |
| #include <semaphore.h> |
| |
| #include "rmr.h" |
| #include "rmr_agnostic.h" |
| #include "test_support.c" // our private library of test tools |
| |
| // ===== dummy context for tools testing so we don't have to pull in all of the nano/nng specific stuff ===== |
| struct uta_ctx { |
| char* my_name; // dns name of this host to set in sender field of a message |
| int shutdown; // thread notification if we need to tell them to stop |
| int max_mlen; // max message length payload+header |
| int max_plen; // max payload length |
| 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 |
| //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 |
| |
| wh_mgt_t* wormholes; // management of user opened wormholes |
| //epoll_stuff_t* eps; // epoll information needed for the rcv with timeout call |
| |
| //pthread_t rtc_th; // thread info for the rtc listener |
| }; |
| |
| |
| #include "tools_static.c" |
| |
| #include "tools_static_test.c" |
| |
| int main( ) { |
| fprintf( stderr, ">>>> starting tools_test\n" ); |
| return tools_test() > 0; |
| } |
| |