- Timestamp:
- Mar 3, 2007 2:16:36 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/include/pjlib-util/stun_session.h
r1034 r1037 21 21 22 22 #include <pjlib-util/stun_msg.h> 23 #include <pjlib-util/stun_auth.h> 23 24 #include <pjlib-util/stun_endpoint.h> 24 25 #include <pjlib-util/stun_transaction.h> … … 148 149 unsigned pkt_size; /**< The actual length of STUN pkt. */ 149 150 150 unsigned options; /**< Options specified when sending */151 151 unsigned addr_len; /**< Length of destination address. */ 152 152 const pj_sockaddr_t *dst_addr; /**< Destination address. */ … … 157 157 158 158 /** 159 * Options that can be specified when creating or sending outgoing STUN160 * messages. These options may be specified as bitmask.161 */162 enum pj_stun_session_send_option163 {164 /**165 * Add short term credential to the message. This option may not be used166 * together with PJ_STUN_USE_LONG_TERM_CRED option.167 */168 PJ_STUN_USE_SHORT_TERM_CRED = 1,169 170 /**171 * Add long term credential to the message. This option may not be used172 * together with PJ_STUN_USE_SHORT_TERM_CRED option.173 */174 PJ_STUN_USE_LONG_TERM_CRED = 2,175 176 /**177 * Add STUN fingerprint to the message.178 */179 PJ_STUN_USE_FINGERPRINT = 4,180 181 /**182 * Instruct the session to cache outgoing response. This can only be183 * used when sending outgoing response message, and when it's specified,184 * the session will use \a res_cache_msec settings in pj_stun_endpoint185 * as the duration of the cache.186 */187 PJ_STUN_CACHE_RESPONSE = 8188 };189 190 191 /**192 159 * Create a STUN session. 193 160 * 194 * @param endpt The STUN endpoint, to be used to register timers etc. 195 * @param name Optional name to be associated with this instance. The 196 * name will be used for example for logging purpose. 197 * @param cb Session callback. 198 * @param p_sess Pointer to receive STUN session instance. 161 * @param endpt The STUN endpoint, to be used to register timers etc. 162 * @param name Optional name to be associated with this instance. The 163 * name will be used for example for logging purpose. 164 * @param cb Session callback. 165 * @param fingerprint Enable message fingerprint for outgoing messages. 166 * @param p_sess Pointer to receive STUN session instance. 199 167 * 200 168 * @return PJ_SUCCESS on success, or the appropriate error code. … … 203 171 const char *name, 204 172 const pj_stun_session_cb *cb, 173 pj_bool_t fingerprint, 205 174 pj_stun_session **p_sess); 206 175 … … 236 205 237 206 /** 238 * Save a long term credential to be used by this STUN session when sending 239 * outgoing messages. After long term credential is configured, application 240 * may specify PJ_STUN_USE_LONG_TERM_CRED option when sending outgoing STUN 241 * message to send the long term credential in the message. 242 * 243 * @param sess The STUN session instance. 244 * @param realm Realm of the long term credential. 245 * @param user The user name. 246 * @param passwd The pain-text password. 247 * 248 * @return PJ_SUCCESS on success, or the appropriate error code. 249 */ 250 PJ_DECL(pj_status_t) 251 pj_stun_session_set_long_term_credential(pj_stun_session *sess, 252 const pj_str_t *realm, 253 const pj_str_t *user, 254 const pj_str_t *passwd); 255 256 257 /** 258 * Save a short term credential to be used by this STUN session when sending 259 * outgoing messages. After short term credential is configured, application 260 * may specify PJ_STUN_USE_SHORT_TERM_CRED option when sending outgoing STUN 261 * message to send the short term credential in the message. 262 * 263 * @param sess The STUN session instance. 264 * @param user The user name. 265 * @param passwd The pain-text password. 266 * 267 * @return PJ_SUCCESS on success, or the appropriate error code. 268 */ 269 PJ_DECL(pj_status_t) 270 pj_stun_session_set_short_term_credential(pj_stun_session *sess, 271 const pj_str_t *user, 272 const pj_str_t *passwd); 273 207 * Set server name to be included in all response. 208 * 209 * @param sess The STUN session instance. 210 * @param srv_name Server name string. 211 * 212 * @return The user data associated with this STUN session. 213 */ 214 PJ_DECL(pj_status_t) pj_stun_session_set_server_name(pj_stun_session *sess, 215 const pj_str_t *srv_name); 216 217 /** 218 * Set credential to be used by this session. Once credential is set, all 219 * outgoing messages will include MESSAGE-INTEGRITY, and all incoming 220 * message will be authenticated against this credential. 221 * 222 * To disable authentication after it has been set, call this function 223 * again with NULL as the argument. 224 * 225 * @param sess The STUN session instance. 226 * @param cred The credential to be used by this session. If NULL 227 * is specified, authentication will be disabled. 228 * 229 * @return PJ_SUCCESS on success, or the appropriate error code. 230 */ 231 PJ_DECL(void) pj_stun_session_set_credential(pj_stun_session *sess, 232 const pj_stun_auth_cred *cred); 274 233 275 234 /** … … 410 369 * 411 370 * @param sess The STUN session instance. 412 * @param options Optional flags, from pj_stun_session_send_option.371 * @param cache_res If PJ_TRUE then response will be cached. 413 372 * @param dst_addr The destination socket address. 414 373 * @param addr_len Length of destination address. … … 419 378 */ 420 379 PJ_DECL(pj_status_t) pj_stun_session_send_msg(pj_stun_session *sess, 421 unsigned options,380 pj_bool_t cache_res, 422 381 const pj_sockaddr_t *dst_addr, 423 382 unsigned addr_len,
Note: See TracChangeset
for help on using the changeset viewer.