Changeset 720 for pjproject/trunk/pjsip/src/pjsip/sip_transport.c
- Timestamp:
- Sep 14, 2006 4:07:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r635 r720 98 98 * Transport names. 99 99 */ 100 conststruct100 struct 101 101 { 102 102 pjsip_transport_type_e type; … … 104 104 pj_str_t name; 105 105 unsigned flag; 106 } transport_names[] = 106 char name_buf[16]; 107 } transport_names[16] = 107 108 { 108 109 { PJSIP_TRANSPORT_UNSPECIFIED, 0, {"Unspecified", 11}, 0}, … … 114 115 { PJSIP_TRANSPORT_LOOP_DGRAM, 15060, {"LOOP-DGRAM", 10}, PJSIP_TRANSPORT_DATAGRAM}, 115 116 }; 117 118 119 /* 120 * Register new transport type to PJSIP. 121 */ 122 PJ_DECL(pj_status_t) pjsip_transport_register_type(unsigned tp_flag, 123 const char *tp_name, 124 int def_port, 125 int *p_tp_type) 126 { 127 unsigned i; 128 129 PJ_ASSERT_RETURN(tp_flag && tp_name && def_port, PJ_EINVAL); 130 PJ_ASSERT_RETURN(pj_ansi_strlen(tp_name) < 131 PJ_ARRAY_SIZE(transport_names[0].name_buf), 132 PJ_ENAMETOOLONG); 133 134 for (i=1; i<PJ_ARRAY_SIZE(transport_names); ++i) { 135 if (transport_names[i].type == 0) 136 break; 137 } 138 139 if (i == PJ_ARRAY_SIZE(transport_names)) 140 return PJ_ETOOMANY; 141 142 transport_names[i].type = (pjsip_transport_type_e)i; 143 transport_names[i].port = (pj_uint16_t)def_port; 144 pj_ansi_strcpy(transport_names[i].name_buf, tp_name); 145 transport_names[i].name = pj_str(transport_names[i].name_buf); 146 transport_names[i].flag = tp_flag; 147 148 if (p_tp_type) 149 *p_tp_type = i; 150 151 return PJ_SUCCESS; 152 } 116 153 117 154
Note: See TracChangeset
for help on using the changeset viewer.