gana

GNUnet Assigned Numbers Authority
Log | Files | Refs | README | LICENSE

h.footer (806B)


      1   {
      2     .name = NULL,
      3     .port = 0
      4   }
      5 };
      6 
      7 uint16_t
      8 GNUNET_GNS_service_port_name_to_number (const char *name);
      9 
     10 uint16_t
     11 GNUNET_GNS_service_port_name_to_number (const char *name)
     12 {
     13   int i = 0;
     14   while (NULL != GNUNET_GNS_ServicePorts[i].name)
     15   {
     16     if (0 == strcmp (name, GNUNET_GNS_ServicePorts[i].name))
     17       return GNUNET_GNS_ServicePorts[i].port;
     18     i++;
     19   }
     20   return 0;
     21 }
     22 
     23 const char*
     24 GNUNET_GNS_service_port_number_to_name (uint16_t port);
     25 
     26 const char*
     27 GNUNET_GNS_service_port_number_to_name (uint16_t port)
     28 {
     29   int i = 0;
     30   while (NULL != GNUNET_GNS_ServicePorts[i].name)
     31   {
     32     if (port == GNUNET_GNS_ServicePorts[i].port)
     33       return GNUNET_GNS_ServicePorts[i].name;
     34     i++;
     35   }
     36   return NULL;
     37 }
     38 
     39 
     40 #if 0 /* keep Emacsens' auto-indent happy */
     41 {
     42 #endif
     43 #ifdef __cplusplus
     44 }
     45 #endif
     46 
     47 #endif