h.footer (784B)
1 { 2 .name = NULL, 3 .number = 0 4 } 5 }; 6 7 uint16_t 8 GNUNET_GNS_protocol_name_to_number (const char *name); 9 10 uint16_t 11 GNUNET_GNS_protocol_name_to_number (const char *name) 12 { 13 int i = 0; 14 while (NULL != GNUNET_GNS_Protocols[i].name) 15 { 16 if (0 == strcmp (name, GNUNET_GNS_Protocols[i].name)) 17 return GNUNET_GNS_Protocols[i].number; 18 i++; 19 } 20 return 0; 21 } 22 23 const char* 24 GNUNET_GNS_protocol_number_to_name (uint16_t number); 25 26 const char* 27 GNUNET_GNS_protocol_number_to_name (uint16_t number) 28 { 29 int i = 0; 30 while (NULL != GNUNET_GNS_Protocols[i].name) 31 { 32 if (number == GNUNET_GNS_Protocols[i].number) 33 return GNUNET_GNS_Protocols[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