Changeset 720
- Timestamp:
- Sep 14, 2006 4:07:49 PM (18 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r622 r720 79 79 #define PJSIP_TRANSPORT_IS_SECURE(tp) \ 80 80 ((tp)->flag & PJSIP_TRANSPORT_SECURE) 81 82 /** 83 * Register new transport type to PJSIP. The PJSIP transport framework 84 * contains the info for some standard transports, as declared by 85 * #pjsip_transport_type_e. Application may use non-standard transport 86 * with PJSIP, but before it does so, it must register the information 87 * about the new transport type to PJSIP by calling this function. 88 * 89 * @param tp_flag The flags describing characteristics of this 90 * transport type. 91 * @param tp_name Transport type name. 92 * @param def_port Default port to be used for the transport. 93 * @param p_tp_type On successful registration, it will be filled with 94 * the registered type. This argument is optional. 95 * 96 * @return PJ_SUCCESS if registration is successful, or 97 * PJSIP_ETYPEEXISTS if the same transport type has 98 * already been registered. 99 */ 100 PJ_DECL(pj_status_t) pjsip_transport_register_type(unsigned tp_flag, 101 const char *tp_name, 102 int def_port, 103 int *p_tp_type); 104 81 105 82 106 /** -
pjproject/trunk/pjsip/include/pjsip/sip_types.h
r622 r720 80 80 81 81 /** Loopback (datagram, unreliable) */ 82 PJSIP_TRANSPORT_LOOP_DGRAM 82 PJSIP_TRANSPORT_LOOP_DGRAM, 83 84 /** Start of user defined transport */ 85 PJSIP_TRANSPORT_START_OTHER 83 86 84 87 } pjsip_transport_type_e; -
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.