[hipl-commit] [trunk] Rev 4264: lib: Mark all functions only used within their files as static.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 13 Apr 2010 19:00:18 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 13/04/2010 at 19:00:18
Revision: 4264
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  lib: Mark all functions only used within their files as static.

Modified:
  M  lib/conf/hipconf.c
  M  lib/core/builder.c
  M  lib/core/builder.h
  M  lib/core/debug.h
  M  lib/core/hashtable.c
  M  lib/core/hip_capability.c
  M  lib/core/hostsfiles.c
  M  lib/opphip/wrap.c
  M  lib/opphip/wrap_db.c

=== modified file 'lib/conf/hipconf.c'
--- lib/conf/hipconf.c  2010-04-13 10:59:42 +0000
+++ lib/conf/hipconf.c  2010-04-13 15:59:48 +0000
@@ -464,7 +464,7 @@
  *           ret = ACTION_NEWACT;
  *       ...
  */
-int hip_conf_get_action(char *argv[])
+static int hip_conf_get_action(char *argv[])
 {
     int ret = -1;
 
@@ -560,7 +560,7 @@
  * @param  action action type
  * @return how many arguments needs to be given at least
  */
-int hip_conf_check_action_argc(int action)
+static int hip_conf_check_action_argc(int action)
 {
     int count = 0;
 
@@ -622,7 +622,7 @@
  * @param  text the type as a string
  * @return the numeric type id correspoding to the symbolic text
  */
-int hip_conf_get_type(char *text, char *argv[])
+static int hip_conf_get_type(char *text, char *argv[])
 {
     int ret = -1;
 
@@ -738,7 +738,7 @@
  * @return an index for argv[], which indicates the type argument.
  *         Usually either 1 or 2.
  */
-int hip_conf_get_type_arg(int action)
+static int hip_conf_get_type_arg(int action)
 {
     int type_arg = -1;
 
@@ -801,8 +801,8 @@
  *                  should block for a response from hipd
  * @return zero for success and negative on error
  */
-int resolve_hostname_to_id(const char *hostname, struct in6_addr *id,
-                           int match_hip)
+static int resolve_hostname_to_id(const char *hostname, struct in6_addr *id,
+                                  int match_hip)
 {
     int err              = 1;
     struct addrinfo *res = NULL, *rp;
@@ -2780,10 +2780,10 @@
  * @param optc   the number of elements in the array (@b 0).
  * @return       zero on success, or negative error value on error.
  */
-int hip_conf_handle_hi3(hip_common_t *msg,
-                        int action,
-                        const char *opt[],
-                        int optc, int send_only)
+static int hip_conf_handle_hi3(hip_common_t *msg,
+                               int action,
+                               const char *opt[],
+                               int optc, int send_only)
 {
     int err = 0, status = 0;
 

=== modified file 'lib/core/builder.c'
--- lib/core/builder.c  2010-04-09 15:20:38 +0000
+++ lib/core/builder.c  2010-04-13 15:59:48 +0000
@@ -126,9 +126,9 @@
  *
  * @see hip_build_endpoint_hdr()
  */
-void hip_build_param_host_id_only_priv(struct hip_host_id_priv *host_id,
-                                       const void *rr_data,
-                                       const char *fqdn)
+static void hip_build_param_host_id_only_priv(struct hip_host_id_priv *host_id,
+                                              const void *rr_data,
+                                              const char *fqdn)
 {
     unsigned int rr_len = ntohs(host_id->hi_length) -
                           sizeof(struct hip_host_id_key_rdata);
@@ -225,7 +225,7 @@
  * @note compared to hip_convert_msg_total_len_to_bytes_16(), this
  *       function inputs an 8-bit integer
  */
-uint16_t hip_convert_msg_total_len_to_bytes(const hip_hdr_len_t len)
+static uint16_t hip_convert_msg_total_len_to_bytes(const hip_hdr_len_t len)
 {
     return (len == 0) ? 0 : ((len + 1) << 3);
 }
@@ -239,7 +239,7 @@
  * @note compared to hip_convert_msg_total_len_to_bytes(), this
  *       function inputs a 16-bit integer
  */
-uint16_t hip_convert_msg_total_len_to_bytes_16(uint16_t len)
+static uint16_t hip_convert_msg_total_len_to_bytes_16(uint16_t len)
 {
     return (len == 0) ? 0 : ((len + 1) << 3);
 }
@@ -416,7 +416,7 @@
  * @param tlv_common pointer to the parameter
  * @param type type of the parameter (in host byte order)
  */
-void hip_set_param_type(struct hip_tlv_common *tlv_generic, hip_tlv_type_t 
type)
+static void hip_set_param_type(struct hip_tlv_common *tlv_generic, 
hip_tlv_type_t type)
 {
     tlv_generic->type = htons(type);
 }
@@ -600,7 +600,7 @@
  * @return 1 if the message length is valid, or 0 if the message length is
  *          invalid
  */
-int hip_check_user_msg_len(const struct hip_common *msg)
+static int hip_check_user_msg_len(const struct hip_common *msg)
 {
     uint16_t len;
 
@@ -642,7 +642,7 @@
  * @return 1 if the message type is valid, or 0 if the message type is
  *          invalid
  */
-int hip_check_network_msg_type(const struct hip_common *msg)
+static int hip_check_network_msg_type(const struct hip_common *msg)
 {
     int ok                     = 0;
     hip_hdr_type_t supported[] =
@@ -677,7 +677,7 @@
  *
  * @return 1 if parameter type is valid, or 0 if parameter type is invalid
  */
-int hip_check_userspace_param_type(const struct hip_tlv_common *param)
+static int hip_check_userspace_param_type(const struct hip_tlv_common *param)
 {
     return 1;
 }
@@ -698,7 +698,7 @@
  *       here only be the parameters listed in Sections 5.2.3 through Section
  *       5.2.18 of the draft-ietf-hip-base-06?
  */
-int hip_check_network_param_type(const struct hip_tlv_common *param)
+static int hip_check_network_param_type(const struct hip_tlv_common *param)
 {
     int ok                 = 0;
     hip_tlv_type_t i;
@@ -790,8 +790,8 @@
  * @note The msg is passed also in to check to the parameter will not cause 
buffer
  * overflows.
  */
-int hip_check_param_contents_len(const struct hip_common *msg,
-                                 const struct hip_tlv_common *param)
+static int hip_check_param_contents_len(const struct hip_common *msg,
+                                        const struct hip_tlv_common *param)
 {
     int ok        = 0;
     int param_len = hip_get_param_total_len(param);
@@ -1088,9 +1088,9 @@
  * @param contents_size size of the contents after the TLV header
  *                 (in host byte order)
  */
-void hip_calc_generic_param_len(struct hip_tlv_common *tlv_common,
-                                hip_tlv_len_t tlv_size,
-                                hip_tlv_len_t contents_size)
+static void hip_calc_generic_param_len(struct hip_tlv_common *tlv_common,
+                                       hip_tlv_len_t tlv_size,
+                                       hip_tlv_len_t contents_size)
 {
     hip_set_param_contents_len(tlv_common,
                                tlv_size + contents_size -
@@ -1108,7 +1108,8 @@
  * @param contents_size size of the contents after type and length fields
  *                 (in host byte order)
  */
-void hip_calc_param_len(struct hip_tlv_common *tlv_common, hip_tlv_len_t 
contents_size)
+static void hip_calc_param_len(struct hip_tlv_common *tlv_common,
+                               hip_tlv_len_t contents_size)
 {
     hip_calc_generic_param_len(tlv_common,
                                sizeof(struct hip_tlv_common),
@@ -1427,7 +1428,7 @@
  * @todo this function may be unneccessary because the input handlers
  *       already do some checking. Currently they are double checked..
  */
-int hip_check_network_param_attributes(const struct hip_tlv_common *param)
+static int hip_check_network_param_attributes(const struct hip_tlv_common 
*param)
 {
     hip_tlv_type_t type = hip_get_param_type(param);
     int err             = 0;
@@ -2824,7 +2825,7 @@
  * @param transform_type the type of the transform
  * @return the number of suite ids that can be used for transform_type
  */
-uint16_t hip_get_transform_max(hip_tlv_type_t transform_type)
+static uint16_t hip_get_transform_max(hip_tlv_type_t transform_type)
 {
     uint16_t transform_max = 0;
 
@@ -3674,8 +3675,8 @@
  * @param endpoint the endpoint structure
  * @return zero on success and negative on failure
  */
-int hip_build_param_eid_endpoint_from_host_id(struct hip_common *msg,
-                                              const struct endpoint_hip 
*endpoint)
+static int hip_build_param_eid_endpoint_from_host_id(struct hip_common *msg,
+                                                     const struct endpoint_hip 
*endpoint)
 {
     int err = 0;
 
@@ -3694,8 +3695,8 @@
  * @param endpoint an endpoint structure containing a HIT
  * @return zero on success and negative on failure
  */
-int hip_build_param_eid_endpoint_from_hit(struct hip_common *msg,
-                                          const struct endpoint_hip *endpoint)
+static int hip_build_param_eid_endpoint_from_hit(struct hip_common *msg,
+                                                 const struct endpoint_hip 
*endpoint)
 {
     struct hip_eid_endpoint eid_endpoint;
     int err = 0;
@@ -4358,12 +4359,12 @@
  * @param is_dsa 1 if the key is DSA or zero for RSA
  * @return zero on success and negative on failure
  */
-int hip_any_key_to_hit(void *any_key,
-                       unsigned char *any_key_rr,
-                       int hit_type,
-                       hip_hit_t *hit,
-                       int is_public,
-                       int is_dsa)
+static int hip_any_key_to_hit(void *any_key,
+                              unsigned char *any_key_rr,
+                              int hit_type,
+                              hip_hit_t *hit,
+                              int is_public,
+                              int is_dsa)
 {
     int err = 0, key_rr_len;
     unsigned char *key_rr = NULL;

=== modified file 'lib/core/builder.h'
--- lib/core/builder.h  2010-03-10 17:44:36 +0000
+++ lib/core/builder.h  2010-04-13 15:59:48 +0000
@@ -53,10 +53,9 @@
 int hip_build_param_eid_endpoint(struct hip_common *,
                                  const struct endpoint_hip *);
 int hip_build_param_eid_iface(struct hip_common *, hip_eid_iface_type_t);
-int
-        hip_build_param_eid_sockaddr(struct hip_common *,
-                                     struct sockaddr *,
-                                     size_t);
+int hip_build_param_eid_sockaddr(struct hip_common *,
+                                 struct sockaddr *,
+                                 size_t);
 int hip_build_param_encrypted_3des_sha1(struct hip_common *,
                                         struct hip_tlv_common *);
 int hip_build_param_encrypted_aes_sha1(struct hip_common *,

=== modified file 'lib/core/debug.h'
--- lib/core/debug.h    2010-03-19 08:47:02 +0000
+++ lib/core/debug.h    2010-04-13 15:59:48 +0000
@@ -172,6 +172,12 @@
                  const char *prefix,
                  const void *str,
                  int len);
+int hip_hexdump_parsed(const char *file,
+                       int line,
+                       const char *function,
+                       const char *prefix,
+                       const void *str,
+                       int len);
 void hip_print_packet(const char *file,
                       int line,
                       const char *function,

=== modified file 'lib/core/hashtable.c'
--- lib/core/hashtable.c        2010-03-10 17:44:36 +0000
+++ lib/core/hashtable.c        2010-04-13 15:59:48 +0000
@@ -30,7 +30,7 @@
  * @param ptr an pointer to hash (must be at least 32 bits)
  * @return a hash of the first 32-bits of the ptr's data
  */
-unsigned long hip_hash_generic(const void *ptr)
+static unsigned long hip_hash_generic(const void *ptr)
 {
     unsigned long hash = (unsigned long) (*((uint32_t *) ptr));
     return hash % ULONG_MAX;
@@ -43,7 +43,7 @@
  * @param ptr2 a pointer to an item in the hash table
  * @return zero if the pointers match or one otherwise
  */
-int hip_match_generic(const void *ptr1, const void *ptr2)
+static int hip_match_generic(const void *ptr1, const void *ptr2)
 {
     return ptr1 != ptr2;
 }

=== modified file 'lib/core/hip_capability.c'
--- lib/core/hip_capability.c   2010-04-08 16:20:56 +0000
+++ lib/core/hip_capability.c   2010-04-13 15:59:48 +0000
@@ -47,7 +47,7 @@
  * @param the name to map
  * @return the UID or -1 on error
  */
-int hip_user_to_uid(char *name)
+static int hip_user_to_uid(char *name)
 {
     int uid            = -1;
     int i;

=== modified file 'lib/core/hostsfiles.c'
--- lib/core/hostsfiles.c       2010-04-09 15:20:38 +0000
+++ lib/core/hostsfiles.c       2010-04-13 15:59:48 +0000
@@ -62,9 +62,9 @@
  *        written. Minimum buffer length is HOST_NAME_MAX chars.
  * @return zero on match or one otherwise
  */
-int hip_map_first_lsi_to_hostname_from_hosts(const struct hosts_file_line 
*entry,
-                                             const void *arg,
-                                             void *result)
+static int hip_map_first_lsi_to_hostname_from_hosts(const struct 
hosts_file_line *entry,
+                                                    const void *arg,
+                                                    void *result)
 {
     int err    = 1;
     int is_lsi = hip_id_type_match(&entry->id, 2);
@@ -216,9 +216,9 @@
  *               will be calculated
  * @return always one
  */
-int hip_calc_lines_in_hosts(const struct hosts_file_line *entry,
-                            const void *arg,
-                            void *result)
+static int hip_calc_lines_in_hosts(const struct hosts_file_line *entry,
+                                   const void *arg,
+                                   void *result)
 {
     int *res = (int *) result;
     (*res)++;
@@ -236,9 +236,9 @@
  *        the minimum buffer length is sizeof(struct in6_addr).
  * @return zero on match or one otherwise
  */
-int hip_get_nth_id_from_hosts(const struct hosts_file_line *entry,
-                              const void *arg,
-                              void *result)
+static int hip_get_nth_id_from_hosts(const struct hosts_file_line *entry,
+                                     const void *arg,
+                                     void *result)
 {
     int err         = 1;
     const int *nth  = (const int *) arg;

=== modified file 'lib/opphip/wrap.c'
--- lib/opphip/wrap.c   2010-04-13 10:59:42 +0000
+++ lib/opphip/wrap.c   2010-04-13 15:59:48 +0000
@@ -88,7 +88,7 @@
  * using LD_PRELOAD.
  *
  */
-void hip_init_dlsym_functions(void)
+static void hip_init_dlsym_functions(void)
 {
     int err     = 0, i;
     char *error = NULL;
@@ -110,7 +110,7 @@
  * Uninitialize the @c dl_function_fd array to stop wrapping of socket calls
  * using LD_PRELOAD.
  */
-void hip_uninit_dlsym_functions(void)
+static void hip_uninit_dlsym_functions(void)
 {
     int i = 0;
     for (i = 0; i < NUMBER_OF_DLSYM_FUNCTIONS; i++) {
@@ -122,7 +122,7 @@
  * Uninitialize all databases.
  *
  */
-void hip_uninitialize_db(void)
+static void hip_uninitialize_db(void)
 {
     hip_uninit_dlsym_functions();
     hip_uninit_socket_db();
@@ -132,7 +132,7 @@
  * Initialize the databases on-the-fly when the application makes
  * socket calls.
  */
-void hip_initialize_db_when_not_exist(void)
+static void hip_initialize_db_when_not_exist(void)
 {
     const char *cfile = "default";
     int err           = 0;
@@ -167,7 +167,7 @@
  * @param hit the local HIT is written here
  * @return zero on success, non-zero on failure
  */
-int hip_get_local_hit_wrapper(hip_hit_t *hit)
+static int hip_get_local_hit_wrapper(hip_hit_t *hit)
 {
     int err                = 0;
     char *param;
@@ -296,11 +296,11 @@
  * @param sa the socket address structure
  * @param sa_len length of @c sa in bytes
  */
-void hip_store_orig_socket_info(hip_opp_socket_t *entry,
-                                int is_peer,
-                                const int socket,
-                                const struct sockaddr *sa,
-                                const socklen_t sa_len)
+static void hip_store_orig_socket_info(hip_opp_socket_t *entry,
+                                       int is_peer,
+                                       const int socket,
+                                       const struct sockaddr *sa,
+                                       const socklen_t sa_len)
 {
     /* Fill in the information of original socket */
     entry->orig_socket = socket;
@@ -328,13 +328,13 @@
  *
  * @return zero on success, non-zero on failure
  */
-int hip_request_peer_hit_from_hipd(const struct in6_addr *peer_ip,
-                                   struct in6_addr *peer_hit,
-                                   const struct in6_addr *local_hit,
-                                   in_port_t *src_tcp_port,
-                                   in_port_t *dst_tcp_port,
-                                   int *fallback,
-                                   int *reject)
+static int hip_request_peer_hit_from_hipd(const struct in6_addr *peer_ip,
+                                          struct in6_addr *peer_hit,
+                                          const struct in6_addr *local_hit,
+                                          in_port_t *src_tcp_port,
+                                          in_port_t *dst_tcp_port,
+                                          int *fallback,
+                                          int *reject)
 {
     struct hip_common *msg = NULL;
     hip_hit_t *ptr         = NULL;
@@ -408,7 +408,7 @@
  * @param entry opportunistic database entry
  * @param is_peer one when setting state for remote host and zero for local 
host
  */
-void hip_translate_to_original(hip_opp_socket_t *entry, int is_peer)
+static void hip_translate_to_original(hip_opp_socket_t *entry, int is_peer)
 {
     /* translated entries correspond to originals   */
     _HIP_DEBUG("Translating to original %d\n", entry->orig_socket);
@@ -447,9 +447,9 @@
  * @param peer one if HIT is remote or zero for local HIT
  * @return
  */
-int hip_set_translation(hip_opp_socket_t *entry,
-                        struct sockaddr_in6 *hit,
-                        int is_peer)
+static int hip_set_translation(hip_opp_socket_t *entry,
+                               struct sockaddr_in6 *hit,
+                               int is_peer)
 {
     int err = 0;
 
@@ -490,7 +490,7 @@
  * @param hit a local HIT used for binding
  * @return same return values as bind()
  */
-int hip_autobind_port(hip_opp_socket_t *entry, struct sockaddr_in6 *hit)
+static int hip_autobind_port(hip_opp_socket_t *entry, struct sockaddr_in6 *hit)
 {
     int err = 0;
 
@@ -534,12 +534,12 @@
  *
  * @return zero on success or non-zero on error
  */
-int hip_translate_new(hip_opp_socket_t *entry,
-                      const int orig_socket,
-                      const struct sockaddr *orig_id,
-                      const socklen_t orig_id_len,
-                      int is_peer, int is_dgram,
-                      int is_translated, int wrap_applicable)
+static int hip_translate_new(hip_opp_socket_t *entry,
+                             const int orig_socket,
+                             const struct sockaddr *orig_id,
+                             const socklen_t orig_id_len,
+                             int is_peer, int is_dgram,
+                             int is_translated, int wrap_applicable)
 {
     int err                   = 0;
     /*the ports needed to send the TCP SYN i1*/
@@ -676,12 +676,13 @@
  * @param wrap_applicable one when wrapping seems plausible and zero otherwise
  * @return
  */
-int hip_old_translation_is_ok(hip_opp_socket_t *entry,
-                              const int orig_socket,
-                              const struct sockaddr *orig_id,
-                              const socklen_t orig_id_len,
-                              int is_peer, int is_dgram,
-                              int is_translated, int wrap_applicable)
+static int hip_old_translation_is_ok(hip_opp_socket_t *entry,
+                                     const int orig_socket,
+                                     const struct sockaddr *orig_id,
+                                     const socklen_t orig_id_len,
+                                     int is_peer, int is_dgram,
+                                     int is_translated,
+                                     int wrap_applicable)
 {
     void *translated_id =
         (is_peer ? &entry->translated_peer_id : &entry->translated_local_id);
@@ -720,7 +721,8 @@
  * @param tid thread identifier
  * @return the created database entry (must be freed by the invoker)
  */
-hip_opp_socket_t *hip_create_new_opp_entry(int pid, const int fd, pthread_t 
tid)
+static hip_opp_socket_t *hip_create_new_opp_entry(int pid, const int fd,
+                                                  pthread_t tid)
 {
     hip_opp_socket_t *entry = NULL;
     int err                 = 0;
@@ -755,8 +757,8 @@
  * @param  protocol protocol value
  * @return zero on success, non-zero on error
  */
-int hip_add_orig_socket_to_db(int socket_fd, int domain, int type,
-                              int protocol)
+static int hip_add_orig_socket_to_db(int socket_fd, int domain,
+                                     int type, int protocol)
 {
     hip_opp_socket_t *entry = NULL;
     int pid                 = 0, err = 0;
@@ -808,11 +810,13 @@
  * @param force_orig one if the caller wants to force fall back to the 
original socket and identifier, zero otherwise
  * @return zero on success, non-zero on error
  */
-int hip_translate_socket(const int *orig_socket, const struct sockaddr 
*orig_id,
-                         const socklen_t *orig_id_len, int **translated_socket,
-                         struct sockaddr **translated_id,
-                         socklen_t **translated_id_len, int is_peer,
-                         int is_dgram, int force_orig)
+static int hip_translate_socket(const int *orig_socket,
+                                const struct sockaddr *orig_id,
+                                const socklen_t *orig_id_len,
+                                int **translated_socket,
+                                struct sockaddr **translated_id,
+                                socklen_t **translated_id_len, int is_peer,
+                                int is_dgram, int force_orig)
 {
     int err                 = 0, pid = 0, is_translated = 0, wrap_applicable = 
0;
     hip_opp_socket_t *entry = NULL;

=== modified file 'lib/opphip/wrap_db.c'
--- lib/opphip/wrap_db.c        2010-04-09 16:24:44 +0000
+++ lib/opphip/wrap_db.c        2010-04-13 15:59:48 +0000
@@ -55,7 +55,7 @@
  * @param ptr the key to index the hash
  * @return hash of the @c key
  */
-unsigned long hip_pid_socket_hash(const void *ptr)
+static unsigned long hip_pid_socket_hash(const void *ptr)
 {
     hip_opp_socket_t *entry = (hip_opp_socket_t *) ptr;
     uint8_t hash[HIP_AH_SHA_LEN];
@@ -80,7 +80,7 @@
  * @param ptr2 hash table key
  * @return return 0 if @c ptr1 and @cptr2 match, otherwise 1
  */
-int hip_socketdb_cmp(const void *ptr1, const void *ptr2)
+static int hip_socketdb_cmp(const void *ptr1, const void *ptr2)
 {
     unsigned long key1, key2;

Other related posts:

  • » [hipl-commit] [trunk] Rev 4264: lib: Mark all functions only used within their files as static. - Diego Biurrun