Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 1 | // : vi ts=4 sw=4 noet : |
| 2 | /* |
| 3 | ================================================================================== |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 4 | Copyright (c) 2019 Nokia |
| 5 | Copyright (c) 2018-2019 AT&T Intellectual Property. |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 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 | |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 11 | http://www.apache.org/licenses/LICENSE-2.0 |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 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 | |
| 22 | /* |
| 23 | Mnemonic: tools_testh.c |
| 24 | Abstract: Unit tests for the RMr tools module. |
| 25 | Author: E. Scott Daniels |
| 26 | Date: 21 January 2019 |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #include <stdio.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <netdb.h> |
| 33 | #include <errno.h> |
| 34 | #include <string.h> |
| 35 | #include <errno.h> |
| 36 | #include <pthread.h> |
| 37 | #include <ctype.h> |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 38 | #include <pthread.h> |
| 39 | #include <semaphore.h> |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 40 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 41 | #include "rmr.h" |
E. Scott Daniels | 0d4def6 | 2020-01-28 16:50:27 -0500 | [diff] [blame^] | 42 | #include "rmr_logging.h" |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 43 | #include "rmr_agnostic.h" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 44 | #include "test_support.c" // our private library of test tools |
| 45 | |
| 46 | // ===== dummy context for tools testing so we don't have to pull in all of the nano/nng specific stuff ===== |
| 47 | struct uta_ctx { |
| 48 | char* my_name; // dns name of this host to set in sender field of a message |
| 49 | int shutdown; // thread notification if we need to tell them to stop |
| 50 | int max_mlen; // max message length payload+header |
| 51 | int max_plen; // max payload length |
| 52 | int flags; // CTXFL_ constants |
| 53 | int nrtele; // number of elements in the routing table |
| 54 | int send_retries; // number of retries send_msg() should attempt if eagain/timeout indicated by nng |
| 55 | //nng_socket nn_sock; // our general listen socket |
| 56 | route_table_t* rtable; // the active route table |
| 57 | route_table_t* old_rtable; // the previously used rt, sits here to allow for draining |
| 58 | route_table_t* new_rtable; // route table under construction |
| 59 | if_addrs_t* ip_list; // list manager of the IP addresses that are on our known interfaces |
| 60 | void* mring; // ring where msgs are queued while waiting for a call response msg |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 61 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 62 | char* rtg_addr; // addr/port of the route table generation publisher |
| 63 | int rtg_port; // the port that the rtg listens on |
E. Scott Daniels | 8790bf0 | 2019-04-23 12:59:28 +0000 | [diff] [blame] | 64 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 65 | wh_mgt_t* wormholes; // management of user opened wormholes |
| 66 | //epoll_stuff_t* eps; // epoll information needed for the rcv with timeout call |
| 67 | |
| 68 | //pthread_t rtc_th; // thread info for the rtc listener |
| 69 | }; |
| 70 | |
| 71 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 72 | #include "tools_static.c" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 73 | |
E. Scott Daniels | 68d09fa | 2019-06-03 19:45:12 +0000 | [diff] [blame] | 74 | #include "tools_static_test.c" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 75 | |
| 76 | int main( ) { |
E. Scott Daniels | 68d09fa | 2019-06-03 19:45:12 +0000 | [diff] [blame] | 77 | fprintf( stderr, ">>>> starting tools_test\n" ); |
| 78 | return tools_test() > 0; |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 79 | } |
E. Scott Daniels | 68d09fa | 2019-06-03 19:45:12 +0000 | [diff] [blame] | 80 | |