diff options
Diffstat (limited to 'gns-service-port-numbers/h.footer')
-rw-r--r-- | gns-service-port-numbers/h.footer | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gns-service-port-numbers/h.footer b/gns-service-port-numbers/h.footer new file mode 100644 index 0000000..e2f02f9 --- /dev/null +++ b/gns-service-port-numbers/h.footer | |||
@@ -0,0 +1,42 @@ | |||
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 | int i = 0; | ||
11 | while (NULL != GNUNET_GNS_ServicePorts[i].name) | ||
12 | { | ||
13 | if (0 == strcmp (name, GNUNET_GNS_ServicePorts[i].name)) | ||
14 | return GNUNET_GNS_ServicePorts[i].port; | ||
15 | i++; | ||
16 | } | ||
17 | return 0; | ||
18 | } | ||
19 | |||
20 | |||
21 | const char* | ||
22 | GNUNET_GNS_service_port_number_to_name (uint16_t port) | ||
23 | { | ||
24 | int i = 0; | ||
25 | while (NULL != GNUNET_GNS_ServicePorts[i].name) | ||
26 | { | ||
27 | if (port == GNUNET_GNS_ServicePorts[i].port) | ||
28 | return GNUNET_GNS_ServicePorts[i].name; | ||
29 | i++; | ||
30 | } | ||
31 | return NULL; | ||
32 | } | ||
33 | |||
34 | |||
35 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
36 | { | ||
37 | #endif | ||
38 | #ifdef __cplusplus | ||
39 | } | ||
40 | #endif | ||
41 | |||
42 | #endif | ||