diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-02-25 11:58:19 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-02-25 11:58:19 +0000 |
commit | cd0277b8c369c89206409d767d47600d3ed38786 (patch) | |
tree | 4ea90a5de7fb5a5842fff3685ac600c93246050b /pjsip/include | |
parent | c80dd76f236e41c653a6e6e95c9fa44c586c6a34 (diff) |
More ticket #1032:
- Updated transport state notification callback to return void.
- Updated transport state enum to only contain connected and disconnected, no more bitmask value.
- Added direction field to SIP transport.
- Removed remote hostname hash from transport key.
- Updated cert info dump to return -1 when buffer is insufficient.
- Added new error code PJSIP_TLS_ECERTVERIF.
- Updated get_cert_name() in ssl_sock_symbian.c to use heap buffer instead of stack.
- Minors, e.g: added prefix PJ in cipher types, docs.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3110 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r-- | pjsip/include/pjsip/sip_errno.h | 5 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transport.h | 76 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transport_tls.h | 41 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 17 |
4 files changed, 62 insertions, 77 deletions
diff --git a/pjsip/include/pjsip/sip_errno.h b/pjsip/include/pjsip/sip_errno.h index 802ab4a2..15f842a9 100644 --- a/pjsip/include/pjsip/sip_errno.h +++ b/pjsip/include/pjsip/sip_errno.h @@ -504,6 +504,11 @@ PJ_BEGIN_DECL * SSL negotiation has exceeded the maximum configured timeout. */ #define PJSIP_TLS_ETIMEDOUT (PJSIP_ERRNO_START_PJSIP+172) /* 171172 */ +/** + * @hideinitializer + * SSL certificate verification error. + */ +#define PJSIP_TLS_ECERTVERIF (PJSIP_ERRNO_START_PJSIP+173) /* 171173 */ /** diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h index 9f6534cd..8da4d561 100644 --- a/pjsip/include/pjsip/sip_transport.h +++ b/pjsip/include/pjsip/sip_transport.h @@ -693,17 +693,30 @@ typedef struct pjsip_transport_key long type; /** - * Hash of host name. - */ - pj_uint32_t hname; - - /** * Destination address. */ pj_sockaddr rem_addr; } pjsip_transport_key; + +/** + * Enumeration of transport direction types. + */ +typedef enum pjsip_transport_dir +{ + PJSIP_TP_DIR_NONE, /**< Direction not set, normally used by + connectionless transports such as + UDP transport. */ + PJSIP_TP_DIR_OUTGOING, /**< Outgoing connection or client mode, + this is only for connection-oriented + transports. */ + PJSIP_TP_DIR_INCOMING, /**< Incoming connection or server mode, + this is only for connection-oriented + transports. */ +} pjsip_transport_dir; + + /** * This structure represent the "public" interface of a SIP transport. * Applications normally extend this structure to include transport @@ -731,6 +744,7 @@ struct pjsip_transport pj_sockaddr local_addr; /**< Bound address. */ pjsip_host_port local_name; /**< Published name (eg. STUN). */ pjsip_host_port remote_name; /**< Remote address name. */ + pjsip_transport_dir dir; /**< Connection direction. */ pjsip_endpoint *endpt; /**< Endpoint instance. */ pjsip_tpmgr *tpmgr; /**< Transport manager. */ @@ -1130,7 +1144,7 @@ PJ_DECL(pj_status_t) pjsip_tpmgr_acquire_transport(pjsip_tpmgr *mgr, * transport is found, a new one will be created. * * This is an internal function since normally application doesn't have access - * to transport manager. Application should use pjsip_endpt_acquire_transport() + * to transport manager. Application should use pjsip_endpt_acquire_transport2() * instead. * * @param mgr The transport manager instance. @@ -1244,35 +1258,26 @@ PJ_DECL(pj_status_t) pjsip_tpmgr_send_raw(pjsip_tpmgr *mgr, /** * Enumeration of transport state types. */ -typedef enum pjsip_transport_state_type { - - /** Transport connected. */ - PJSIP_TP_STATE_CONNECTED = (1 << 0), - - /** Transport accepted. */ - PJSIP_TP_STATE_ACCEPTED = (1 << 1), - - /** Transport disconnected. */ - PJSIP_TP_STATE_DISCONNECTED = (1 << 2), - - /** Incoming connection rejected. */ - PJSIP_TP_STATE_REJECTED = (1 << 3), - - /** TLS verification error. */ - PJSIP_TP_STATE_TLS_VERIF_ERROR = (1 << 8) - -} pjsip_transport_state_type; +typedef enum pjsip_transport_state +{ + PJSIP_TP_STATE_CONNECTED, /**< Transport connected, applicable only + to connection-oriented transports + such as TCP and TLS. */ + PJSIP_TP_STATE_DISCONNECTED /**< Transport disconnected, applicable + only to connection-oriented + transports such as TCP and TLS. */ +} pjsip_transport_state; /** - * Structure of transport state info. + * Structure of transport state info passed by #pjsip_tp_state_callback. */ typedef struct pjsip_transport_state_info { /** * The last error code related to the transport state. */ pj_status_t status; - + /** * Optional extended info, the content is specific for each transport type. */ @@ -1282,30 +1287,23 @@ typedef struct pjsip_transport_state_info { /** * Type of callback to receive transport state notifications, such as - * transport connected, disconnected or TLS verification error. + * transport connected/disconnected. Application may shutdown the transport + * in this callback. * * @param tp The transport instance. - * @param state The transport state, this may contain single or - * combination of transport state types defined in - * #pjsip_transport_state_type. + * @param state The transport state. * @param info The transport state info. - * - * @return When TLS verification fails and peer verification in - * #pjsip_tls_setting is not set, application may return - * PJ_TRUE to ignore the verification result and continue - * using the transport. On other cases, this return value - * is currently not used and will be ignored. */ -typedef pj_bool_t (*pjsip_tp_state_callback)( +typedef void (*pjsip_tp_state_callback)( pjsip_transport *tp, - pj_uint32_t state, + pjsip_transport_state state, const pjsip_transport_state_info *info); /** * Setting callback of transport state notification. The caller will be * notified whenever the state of transport is changed. The type of - * events are defined in #pjsip_transport_state_type. + * events are defined in #pjsip_transport_state. * * @param mgr Transport manager. * @param cb Callback to be called to notify caller about transport diff --git a/pjsip/include/pjsip/sip_transport_tls.h b/pjsip/include/pjsip/sip_transport_tls.h index f97414b3..ddee2bc2 100644 --- a/pjsip/include/pjsip/sip_transport_tls.h +++ b/pjsip/include/pjsip/sip_transport_tls.h @@ -122,42 +122,36 @@ typedef struct pjsip_tls_setting pj_str_t server_name; /** - * Specifies the action when verification of server TLS certificate - * resulting errors: + * Specifies TLS transport behavior on the server TLS certificate + * verification result: * - If \a verify_server is disabled (set to PJ_FALSE), TLS transport * will just notify the application via #pjsip_tp_state_callback with - * state (PJSIP_TP_STATE_CONNECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR) - * whenever there is any TLS verification error, the return value of - * the callback will be used to decide whether transport should be - * shutdown. + * state PJSIP_TP_STATE_CONNECTED regardless TLS verification result. * - If \a verify_server is enabled (set to PJ_TRUE), TLS transport * will be shutdown and application will be notified with state - * (PJSIP_TP_STATE_DISCONNECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR) - * whenever there is any TLS verification error. + * PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification + * error, otherwise PJSIP_TP_STATE_CONNECTED will be notified. * - * When the verification resulting success, application will be notified - * via #pjsip_tp_state_callback with state PJSIP_TP_STATE_CONNECTED. + * In any cases, application can inspect #pjsip_tls_state_info in the + * callback to see the verification detail. * * Default value is PJ_FALSE. */ pj_bool_t verify_server; /** - * Specifies the action when verification of server TLS certificate - * resulting errors: + * Specifies TLS transport behavior on the client TLS certificate + * verification result: * - If \a verify_client is disabled (set to PJ_FALSE), TLS transport * will just notify the application via #pjsip_tp_state_callback with - * state (PJSIP_TP_STATE_ACCEPTED | PJSIP_TP_STATE_TLS_VERIF_ERROR) - * whenever there is any TLS verification error, the return value of - * the callback will be used to decide whether transport should be - * shutdown. + * state PJSIP_TP_STATE_CONNECTED regardless TLS verification result. * - If \a verify_client is enabled (set to PJ_TRUE), TLS transport * will be shutdown and application will be notified with state - * (PJSIP_TP_STATE_REJECTED | PJSIP_TP_STATE_TLS_VERIF_ERROR) - * whenever there is any TLS verification error. + * PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification + * error, otherwise PJSIP_TP_STATE_CONNECTED will be notified. * - * When the verification resulting success, application will be notified - * via #pjsip_tp_state_callback with state PJSIP_TP_STATE_ACCEPTED. + * In any cases, application can inspect #pjsip_tls_state_info in the + * callback to see the verification detail. * * Default value is PJ_FALSE. */ @@ -165,7 +159,7 @@ typedef struct pjsip_tls_setting /** * When acting as server (incoming TLS connections), reject inocming - * connection if client doesn't have a valid certificate. + * connection if client doesn't supply a TLS certificate. * * This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag. * Default value is PJ_FALSE. @@ -209,8 +203,9 @@ typedef struct pjsip_tls_setting /** - * This structure defines transport state extended info specifically for - * TLS transport. + * This structure defines TLS transport extended info in <tt>ext_info</tt> + * field of #pjsip_transport_state_info for the transport state notification + * callback #pjsip_tp_state_callback. */ typedef struct pjsip_tls_state_info { diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 45f07d90..451b8c9c 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -846,21 +846,8 @@ typedef struct pjsua_callback /** * This callback is called when transport state is changed. See also * #pjsip_tp_state_callback. - * - * @param tp The transport instance. - * @param state The transport state, this may contain single or - * combination of transport state types defined in - * #pjsip_transport_state_type. - * @param info The transport state info. - * - * @return When TLS verification fails and peer verification in - * #pjsip_tls_setting is not set, application may return - * PJ_TRUE to ignore the verification result and continue - * using the transport. On other cases, this return value - * is currently not used and will be ignored. - */ - pj_bool_t (*on_transport_state)(pjsip_transport *tp, pj_uint32_t state, - const pjsip_transport_state_info *info); + */ + pjsip_tp_state_callback on_transport_state; } pjsua_callback; |