Committer: Diego Biurrun <diego@xxxxxxxxxx> Date: 13/04/2010 at 18:47:43 Revision: 4261 Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: test/tools: Mark all functions only used within their files as static. Modified: M test/auth_performance.c M test/certteststub.c M test/conntest.c M test/cookietest.c M test/dh_performance.c M test/hashtest.c M test/hc_performance.c M tools/pisacert.c === modified file 'test/auth_performance.c' --- test/auth_performance.c 2010-04-09 16:24:44 +0000 +++ test/auth_performance.c 2010-04-13 15:47:28 +0000 @@ -41,7 +41,7 @@ * * \return void */ -void print_timeres(void) +static void print_timeres(void) { struct timeval tv1, tv2; int i; === modified file 'test/certteststub.c' --- test/certteststub.c 2010-04-09 16:24:44 +0000 +++ test/certteststub.c 2010-04-13 15:47:28 +0000 @@ -38,7 +38,7 @@ * @note this is just a test function for the certteststub and not very usefull for * anything else unless modified */ -void compression_test(unsigned char *orig, int len) +static void compression_test(unsigned char *orig, int len) { unsigned char original[1024]; unsigned char compressed[1024]; === modified file 'test/conntest.c' --- test/conntest.c 2010-04-12 15:40:34 +0000 +++ test/conntest.c 2010-04-13 15:47:28 +0000 @@ -155,7 +155,7 @@ * @param local_port the local port for which to bind to * @return zero on success or negative on failure */ -int create_udp_ipv4_socket(in_port_t local_port) +static int create_udp_ipv4_socket(in_port_t local_port) { int ipv4_sock = -1, err = 0, on = 1; struct sockaddr_in inaddr_any; @@ -225,9 +225,9 @@ * @param peer_addr the peer address to use for sending * @return zero on success or negative on failure */ -int udp_send_msg(int sock, uint8_t *data, size_t data_len, - struct sockaddr *local_addr, - struct sockaddr *peer_addr) +static int udp_send_msg(int sock, uint8_t *data, size_t data_len, + struct sockaddr *local_addr, + struct sockaddr *peer_addr) { int err = 0, sendnum; int is_ipv4 = ((peer_addr->sa_family == AF_INET) ? 1 : 0); @@ -306,7 +306,7 @@ * @param local_port the local port to which to bind * @return zero on success or negative on failure */ -int main_server_udp(int ipv4_sock, int ipv6_sock, in_port_t local_port) +static int main_server_udp(int ipv4_sock, int ipv6_sock, in_port_t local_port) { /* Use recvmsg/sendmsg instead of recvfrom/sendto because * the latter combination may choose a different source === modified file 'test/cookietest.c' --- test/cookietest.c 2010-04-09 16:24:44 +0000 +++ test/cookietest.c 2010-04-13 15:47:28 +0000 @@ -10,8 +10,8 @@ #include <sys/time.h> #include <time.h> -void hip_create_puzzle(struct hip_puzzle *puzzle, uint8_t val_K, - uint32_t opaque, uint64_t random_i) +static void hip_create_puzzle(struct hip_puzzle *puzzle, uint8_t val_K, + uint32_t opaque, uint64_t random_i) { /* only the random_j_k is in host byte order */ puzzle->K = val_K; @@ -22,8 +22,8 @@ puzzle->I = random_i; } -int hip_verify_puzzle(struct hip_common *hdr, struct hip_puzzle *puzzle, - struct hip_solution *solution) +static int hip_verify_puzzle(struct hip_common *hdr, struct hip_puzzle *puzzle, + struct hip_solution *solution) { int err = 1; /* Not really an error: 1=success, 0=failure */ === modified file 'test/dh_performance.c' --- test/dh_performance.c 2010-04-12 15:40:34 +0000 +++ test/dh_performance.c 2010-04-13 15:47:28 +0000 @@ -75,7 +75,7 @@ * \param progname The name of the executable * \return void */ -void dhp_usage(char *progname) +static void dhp_usage(char *progname) { printf( "Usage: %s -c [NUM] -l [NUM]\n" "-c [NUM] : create [NUM] new dh keys for the benchmark\n" @@ -121,21 +121,21 @@ * * \return Returns error code. 0 = Success, 1 = Error. */ -int dhp_getopts(int argc, - char **argv, - int *sw_create_dh, - int *sw_dh_group_id, - int *sw_create_dsa, - int *sw_create_rsa, - int *sw_rsa_keylen, - int *sw_dsa_keylen, - int *sw_bench_loops, - int *sw_print_keys, - int *sw_shared_key_len, - int *sw_hash_chain_len, - int *sw_file_output, - int *sw_cpuload, - int *sw_hash_loops) +static int dhp_getopts(int argc, + char **argv, + int *sw_create_dh, + int *sw_dh_group_id, + int *sw_create_dsa, + int *sw_create_rsa, + int *sw_rsa_keylen, + int *sw_dsa_keylen, + int *sw_bench_loops, + int *sw_print_keys, + int *sw_shared_key_len, + int *sw_hash_chain_len, + int *sw_file_output, + int *sw_cpuload, + int *sw_hash_loops) { int c; opterr = 0; @@ -281,7 +281,7 @@ * \param timeval timeval struct from the OS. * \return void */ -void dhp_start_benchmark(struct timeval *bench_time) +static void dhp_start_benchmark(struct timeval *bench_time) { gettimeofday(bench_time, NULL); } @@ -296,7 +296,7 @@ * \param timeval timeval struct from the OS. * \return passed time since beginning of the interval. */ -double dhp_stop_benchmark(struct timeval *bench_time) +static double dhp_stop_benchmark(struct timeval *bench_time) { struct timeval now; gettimeofday(&now, NULL); === modified file 'test/hashtest.c' --- test/hashtest.c 2010-04-09 16:24:44 +0000 +++ test/hashtest.c 2010-04-13 15:47:28 +0000 @@ -46,7 +46,7 @@ //static hip_list_t socketdb_by_pid_socket_list[HIP_SOCKETDB_SIZE]= { 0 }; // inline int, int range removed //miika -unsigned long hip_hash_pid_socket(const void *ptr) +static unsigned long hip_hash_pid_socket(const void *ptr) { unsigned long key = ((hip_opp_socket_t *) ptr)->hash_key; _HIP_DEBUG("hip_hash_pid_socket(%p): 0x%x\n", ptr, key); @@ -54,7 +54,7 @@ } // removed: inline -int hip_socketdb_match(const void *ptr1, const void *ptr2) +static int hip_socketdb_match(const void *ptr1, const void *ptr2) { unsigned long key1, key2; key1 = ((hip_opp_socket_t *) ptr1)->hash_key; @@ -73,7 +73,7 @@ *key = pid ^ socket; } -void hip_init_socket_db(void) +static void hip_init_socket_db(void) { #if 0 memset(&socketdb, 0, sizeof(socketdb)); @@ -98,7 +98,7 @@ } } -void hip_uninit_socket_db(void) +static void hip_uninit_socket_db(void) { int n; //int i; @@ -130,7 +130,7 @@ hip_ht_uninit(socketdb); } -hip_opp_socket_t *hip_socketdb_find_entry(int pid, int socket) +static hip_opp_socket_t *hip_socketdb_find_entry(int pid, int socket) { unsigned int key = 0; @@ -140,7 +140,7 @@ return (hip_opp_socket_t *) hip_ht_find(socketdb, (void *) &key); } -int hip_socketdb_add_entry(pid_t pid, int socket) +static int hip_socketdb_add_entry(pid_t pid, int socket) { int err = 0; hip_opp_socket_t *new_item = NULL; @@ -167,7 +167,7 @@ return err; } -void hip_socketdb_dump(void) +static void hip_socketdb_dump(void) { int n; /*int i; @@ -202,7 +202,7 @@ HIP_DEBUG("end socketdb dump\n"); } -void hip_socketdb_del_entry_by_entry(hip_opp_socket_t *entry) +static void hip_socketdb_del_entry_by_entry(hip_opp_socket_t *entry) { _HIP_DEBUG("entry=0x%p pid=%d, orig_socket=%d\n", entry, entry->pid, entry->orig_socket); @@ -212,7 +212,7 @@ HIP_FREE(entry); } -int hip_socketdb_del_entry(int pid, int socket) +static int hip_socketdb_del_entry(int pid, int socket) { hip_opp_socket_t *entry = NULL; @@ -225,7 +225,7 @@ } // used to test socketdb -void test_db(void) +static void test_db(void) { pid_t pid = getpid(); int socket = 1; === modified file 'test/hc_performance.c' --- test/hc_performance.c 2010-03-19 09:00:54 +0000 +++ test/hc_performance.c 2010-04-13 15:47:28 +0000 @@ -27,7 +27,7 @@ int test_ht = 0; -void print_usage(void) +static void print_usage(void) { printf( "Usage: hc_performance -c|t -s|m [-lhvn NUM]\n" "-c = do hash-chain performance tests\n" @@ -49,7 +49,7 @@ * * \return void */ -void print_timeres(void) +static void print_timeres(void) { struct timeval tv1, tv2; int i; === modified file 'tools/pisacert.c' --- tools/pisacert.c 2010-04-09 16:24:44 +0000 +++ tools/pisacert.c 2010-04-13 15:47:28 +0000 @@ -25,7 +25,7 @@ * @param result location to store the result in * @return 0 on success */ -int get_default_hit(struct in6_addr *result) +static int get_default_hit(struct in6_addr *result) { int err = 0; hip_common_t *msg = NULL; @@ -60,8 +60,9 @@ * @param size size of the certificate buffer * @return 0 on success */ -int create_certificate(time_t *not_before, time_t *not_after, - struct in6_addr *hit, char *certificate, size_t size) +static int create_certificate(time_t *not_before, time_t *not_after, + struct in6_addr *hit, char *certificate, + size_t size) { int err = 0; struct hip_cert_spki_info cert = { 0 };