summaryrefslogtreecommitdiff
path: root/pjsip/include/pjsua2/endpoint.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip/include/pjsua2/endpoint.hpp')
-rw-r--r--pjsip/include/pjsua2/endpoint.hpp160
1 files changed, 160 insertions, 0 deletions
diff --git a/pjsip/include/pjsua2/endpoint.hpp b/pjsip/include/pjsua2/endpoint.hpp
index 4fdd0405..da777868 100644
--- a/pjsip/include/pjsua2/endpoint.hpp
+++ b/pjsip/include/pjsua2/endpoint.hpp
@@ -124,6 +124,140 @@ struct OnTimerParam
};
/**
+ * SSL certificate type and name structure.
+ */
+struct SslCertName
+{
+ pj_ssl_cert_name_type type; /**< Name type */
+ string name; /**< The name */
+};
+
+/**
+ * SSL certificate information.
+ */
+struct SslCertInfo
+{
+ unsigned version; /**< Certificate version */
+ unsigned char serialNo[20]; /**< Serial number, array
+ of octets, first index
+ is MSB */
+ string subjectCn; /**< Subject common name */
+ string subjectInfo; /**< One line subject, fields
+ are separated by slash, e.g:
+ "CN=sample.org/OU=HRD" */
+
+ string issuerCn; /**< Issuer common name */
+ string issuerInfo; /**< One line subject, fields
+ are separated by slash */
+
+ TimeVal validityStart; /**< Validity start */
+ TimeVal validityEnd; /**< Validity end */
+ bool validityGmt; /**< Flag if validity
+ date/time use GMT */
+
+ vector<SslCertName> subjectAltName; /**< Subject alternative
+ name extension */
+
+ string raw; /**< Raw certificate in PEM
+ format, only available
+ for remote certificate */
+
+public:
+ /**
+ * Check if the info is set with empty values.
+ *
+ * @return True if the info is empty.
+ */
+ bool isEmpty() const;
+
+ /**
+ * Convert from pjsip
+ */
+ void fromPj(const pj_ssl_cert_info &info);
+};
+
+/**
+ * TLS transport information.
+ */
+struct TlsInfo
+{
+ /**
+ * Describes whether secure socket connection is established, i.e: TLS/SSL
+ * handshaking has been done successfully.
+ */
+ bool established;
+
+ /**
+ * Describes secure socket protocol being used, see #pj_ssl_sock_proto.
+ * Use bitwise OR operation to combine the protocol type.
+ */
+ unsigned protocol;
+
+ /**
+ * Describes cipher suite being used, this will only be set when connection
+ * is established.
+ */
+ pj_ssl_cipher cipher;
+
+ /**
+ * Describes cipher name being used, this will only be set when connection
+ * is established.
+ */
+ string cipherName;
+
+ /**
+ * Describes local address.
+ */
+ SocketAddress localAddr;
+
+ /**
+ * Describes remote address.
+ */
+ SocketAddress remoteAddr;
+
+ /**
+ * Describes active local certificate info. Use SslCertInfo.isEmpty()
+ * to check if the local cert info is available.
+ */
+ SslCertInfo localCertInfo;
+
+ /**
+ * Describes active remote certificate info. Use SslCertInfo.isEmpty()
+ * to check if the remote cert info is available.
+ */
+ SslCertInfo remoteCertInfo;
+
+ /**
+ * Status of peer certificate verification.
+ */
+ unsigned verifyStatus;
+
+ /**
+ * Error messages (if any) of peer certificate verification, based on
+ * the field verifyStatus above.
+ */
+ StringVector verifyMsgs;
+
+public:
+ /**
+ * Constructor.
+ */
+ TlsInfo();
+
+ /**
+ * Check if the info is set with empty values.
+ *
+ * @return True if the info is empty.
+ */
+ bool isEmpty() const;
+
+ /**
+ * Convert from pjsip
+ */
+ void fromPj(const pjsip_tls_state_info &info);
+};
+
+/**
* Parameter of Endpoint::onTransportState() callback.
*/
struct OnTransportStateParam
@@ -132,6 +266,11 @@ struct OnTransportStateParam
* The transport handle.
*/
TransportHandle hnd;
+
+ /**
+ * The transport type.
+ */
+ string type;
/**
* Transport current state.
@@ -142,6 +281,12 @@ struct OnTransportStateParam
* The last error code related to the transport state.
*/
pj_status_t lastError;
+
+ /**
+ * TLS transport info, only used if transport type is TLS. Use
+ * TlsInfo.isEmpty() to check if this info is available.
+ */
+ TlsInfo tlsInfo;
};
/**
@@ -1029,6 +1174,21 @@ public:
* @param id Transport ID.
*/
void transportClose(TransportId id) throw(Error);
+
+ /**
+ * Start graceful shutdown procedure for this transport handle. After
+ * graceful shutdown has been initiated, no new reference can be
+ * obtained for the transport. However, existing objects that currently
+ * uses the transport may still use this transport to send and receive
+ * packets. After all objects release their reference to this transport,
+ * the transport will be destroyed immediately.
+ *
+ * Note: application normally uses this API after obtaining the handle
+ * from onTransportState() callback.
+ *
+ * @param tp The transport.
+ */
+ void transportShutdown(TransportHandle tp) throw(Error);
/*************************************************************************
* Call operations