/src/rtpproxy/external/libre/src/ice/icestr.c
Line | Count | Source |
1 | | /** |
2 | | * @file icestr.c ICE Strings |
3 | | * |
4 | | * Copyright (C) 2010 Creytiv.com |
5 | | */ |
6 | | #include <re_types.h> |
7 | | #include <re_fmt.h> |
8 | | #include <re_mbuf.h> |
9 | | #include <re_list.h> |
10 | | #include <re_tmr.h> |
11 | | #include <re_sa.h> |
12 | | #include <re_stun.h> |
13 | | #include <re_ice.h> |
14 | | #include "ice.h" |
15 | | |
16 | | |
17 | | const char *ice_cand_type2name(enum ice_cand_type type) |
18 | 12.9k | { |
19 | 12.9k | switch (type) { |
20 | | |
21 | 12.9k | case ICE_CAND_TYPE_HOST: return "host"; |
22 | 0 | case ICE_CAND_TYPE_SRFLX: return "srflx"; |
23 | 0 | case ICE_CAND_TYPE_PRFLX: return "prflx"; |
24 | 0 | case ICE_CAND_TYPE_RELAY: return "relay"; |
25 | 0 | default: return "???"; |
26 | 12.9k | } |
27 | 12.9k | } |
28 | | |
29 | | |
30 | | enum ice_cand_type ice_cand_name2type(const char *name) |
31 | 22.4k | { |
32 | 22.4k | if (0 == str_casecmp(name, "host")) return ICE_CAND_TYPE_HOST; |
33 | 6.76k | if (0 == str_casecmp(name, "srflx")) return ICE_CAND_TYPE_SRFLX; |
34 | 1.52k | if (0 == str_casecmp(name, "prflx")) return ICE_CAND_TYPE_PRFLX; |
35 | 1.46k | if (0 == str_casecmp(name, "relay")) return ICE_CAND_TYPE_RELAY; |
36 | | |
37 | 1.39k | return (enum ice_cand_type)-1; |
38 | 1.46k | } |
39 | | |
40 | | |
41 | | const char *ice_mode2name(enum ice_mode mode) |
42 | 0 | { |
43 | 0 | switch (mode) { |
44 | | |
45 | 0 | case ICE_MODE_FULL: return "Full"; |
46 | 0 | case ICE_MODE_LITE: return "Lite"; |
47 | 0 | default: return "???"; |
48 | 0 | } |
49 | 0 | } |
50 | | |
51 | | |
52 | | const char *ice_role2name(enum ice_role role) |
53 | 0 | { |
54 | 0 | switch (role) { |
55 | | |
56 | 0 | case ICE_ROLE_UNKNOWN: return "Unknown"; |
57 | 0 | case ICE_ROLE_CONTROLLING: return "Controlling"; |
58 | 0 | case ICE_ROLE_CONTROLLED: return "Controlled"; |
59 | 0 | default: return "???"; |
60 | 0 | } |
61 | 0 | } |
62 | | |
63 | | |
64 | | const char *ice_candpair_state2name(enum ice_candpair_state st) |
65 | 0 | { |
66 | 0 | switch (st) { |
67 | | |
68 | 0 | case ICE_CANDPAIR_FROZEN: return "Frozen"; |
69 | 0 | case ICE_CANDPAIR_WAITING: return "Waiting"; |
70 | 0 | case ICE_CANDPAIR_INPROGRESS: return "InProgress"; |
71 | 0 | case ICE_CANDPAIR_SUCCEEDED: return "Succeeded"; |
72 | 0 | case ICE_CANDPAIR_FAILED: return "Failed"; |
73 | 0 | default: return "???"; |
74 | 0 | } |
75 | 0 | } |
76 | | |
77 | | |
78 | | const char *ice_checkl_state2name(enum ice_checkl_state cst) |
79 | 0 | { |
80 | 0 | switch (cst) { |
81 | | |
82 | 0 | case ICE_CHECKLIST_NULL: return "(NULL)"; |
83 | 0 | case ICE_CHECKLIST_RUNNING: return "Running"; |
84 | 0 | case ICE_CHECKLIST_COMPLETED: return "Completed"; |
85 | 0 | case ICE_CHECKLIST_FAILED: return "Failed"; |
86 | 0 | default: return "???"; |
87 | 0 | } |
88 | 0 | } |