diff options
Diffstat (limited to 'pjnath/include')
-rw-r--r-- | pjnath/include/pjnath.h | 1 | ||||
-rw-r--r-- | pjnath/include/pjnath/errno.h | 133 | ||||
-rw-r--r-- | pjnath/include/pjnath/ice.h | 22 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_msg.h | 1 | ||||
-rw-r--r-- | pjnath/include/pjnath/types.h | 33 |
5 files changed, 76 insertions, 114 deletions
diff --git a/pjnath/include/pjnath.h b/pjnath/include/pjnath.h index 8574631d..68eab315 100644 --- a/pjnath/include/pjnath.h +++ b/pjnath/include/pjnath.h @@ -27,3 +27,4 @@ #include <pjnath/stun_session.h> #include <pjnath/stun_transaction.h> #include <pjnath/types.h> + diff --git a/pjnath/include/pjnath/errno.h b/pjnath/include/pjnath/errno.h index 7fbd9837..c5a2afa5 100644 --- a/pjnath/include/pjnath/errno.h +++ b/pjnath/include/pjnath/errno.h @@ -23,7 +23,7 @@ #include <pj/errno.h> /** - * @defgroup PJNATH_ERROR NAT Helper Error Codes + * @defgroup PJNATH_ERROR NAT Helper Library Error Codes * @ingroup PJNATH * @{ */ @@ -35,154 +35,119 @@ #define PJNATH_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4) - /************************************************************ - * NEW STUN ERROR + * STUN MESSAGING ERRORS ***********************************************************/ -/* Messaging errors */ -#define PJNATH_ESTUNINATTRLEN -1 -#define PJNATH_ESTUNINMSGLEN -1 -#define PJNATH_ESTUNINMSGTYPE -1 -#define PJNATH_ESTUNFINGERPRINT -1 -#define PJNATH_ESTUNNOTRESPOND -1 -#define PJNATH_ESTUNNOXORMAP -1 /** - * @hideinitializer - * Too many STUN attributes. - */ -#define PJNATH_ESTUNTOOMANYATTR (PJNATH_ERRNO_START+110)/* 370110 */ -/** - * @hideinitializer - * Unknown STUN attribute. This error happens when the decoder encounters - * mandatory attribute type which it doesn't understand. - */ -#define PJNATH_ESTUNUNKNOWNATTR (PJNATH_ERRNO_START+111)/* 370111 */ -/** - * @hideinitializer - * Invalid STUN socket address length. - */ -#define PJNATH_ESTUNINADDRLEN (PJNATH_ERRNO_START+112)/* 370112 */ -/** - * @hideinitializer - * STUN IPv6 attribute not supported - */ -#define PJNATH_ESTUNIPV6NOTSUPP (PJNATH_ERRNO_START+113)/* 370113 */ -/** - * @hideinitializer - * Expecting STUN response message. + * Map STUN error code (300-699) into pj_status_t error space. */ -#define PJNATH_ESTUNNOTRESPONSE (PJNATH_ERRNO_START+114)/* 370114 */ -/** - * @hideinitializer - * STUN transaction ID mismatch. - */ -#define PJNATH_ESTUNINVALIDID (PJNATH_ERRNO_START+115)/* 370115 */ +#define PJ_STATUS_FROM_STUN_CODE(code) (PJNATH_ERRNO_START+code) + /** * @hideinitializer - * Unable to find handler for the request. + * Invalid STUN message length. */ -#define PJNATH_ESTUNNOHANDLER (PJNATH_ERRNO_START+116)/* 370116 */ +#define PJNATH_EINSTUNMSGLEN (PJNATH_ERRNO_START+1) /* 370001 */ /** * @hideinitializer - * Found non-FINGERPRINT attribute after MESSAGE-INTEGRITY. This is not - * valid since MESSAGE-INTEGRITY MUST be the last attribute or the - * attribute right before FINGERPRINT before the message. + * Invalid or unexpected STUN message type */ -#define PJNATH_ESTUNMSGINTPOS (PJNATH_ERRNO_START+118)/* 370118 */ +#define PJNATH_EINSTUNMSGTYPE (PJNATH_ERRNO_START+2) /* 370002 */ /** * @hideinitializer - * Found attribute after FINGERPRINT. This is not valid since FINGERPRINT - * MUST be the last attribute in the message. + * STUN transaction has timed out */ -#define PJNATH_ESTUNFINGERPOS (PJNATH_ERRNO_START+119)/* 370119 */ +#define PJNATH_ESTUNTIMEDOUT (PJNATH_ERRNO_START+3) /* 370003 */ + + + /** * @hideinitializer - * Missing STUN USERNAME attribute. - * When credential is included in the STUN message (MESSAGE-INTEGRITY is - * present), the USERNAME attribute must be present in the message. + * Too many STUN attributes. */ -#define PJNATH_ESTUNNOUSERNAME (PJNATH_ERRNO_START+120)/* 370120 */ +#define PJNATH_ESTUNTOOMANYATTR (PJNATH_ERRNO_START+21) /* 370021 */ /** * @hideinitializer - * Unknown STUN username/credential. + * Invalid STUN attribute length. */ -#define PJNATH_ESTUNUSERNAME (PJNATH_ERRNO_START+121)/* 370121 */ +#define PJNATH_ESTUNINATTRLEN (PJNATH_ERRNO_START+22) /* 370022 */ /** * @hideinitializer - * Missing/invalidSTUN MESSAGE-INTEGRITY attribute. + * Found duplicate STUN attribute. */ -#define PJNATH_ESTUNMSGINT (PJNATH_ERRNO_START+122)/* 370122 */ +#define PJNATH_ESTUNDUPATTR (PJNATH_ERRNO_START+23) /* 370023 */ + /** * @hideinitializer - * Found duplicate STUN attribute. + * STUN FINGERPRINT verification failed */ -#define PJNATH_ESTUNDUPATTR (PJNATH_ERRNO_START+123)/* 370123 */ +#define PJNATH_ESTUNFINGERPRINT (PJNATH_ERRNO_START+30) /* 370030 */ /** * @hideinitializer - * Missing STUN REALM attribute. + * Invalid STUN attribute after MESSAGE-INTEGRITY. */ -#define PJNATH_ESTUNNOREALM (PJNATH_ERRNO_START+124)/* 370124 */ +#define PJNATH_ESTUNMSGINTPOS (PJNATH_ERRNO_START+31) /* 370031 */ /** * @hideinitializer - * Missing/stale STUN NONCE attribute value. + * Invalid STUN attribute after FINGERPRINT. */ -#define PJNATH_ESTUNNONCE (PJNATH_ERRNO_START+125)/* 370125 */ +#define PJNATH_ESTUNFINGERPOS (PJNATH_ERRNO_START+33) /* 370033 */ + + /** * @hideinitializer - * STUN transaction terminates with failure. + * STUN (XOR-)MAPPED-ADDRESS attribute not found */ -#define PJNATH_ESTUNTSXFAILED (PJNATH_ERRNO_START+126)/* 370126 */ +#define PJNATH_ESTUNNOMAPPEDADDR (PJNATH_ERRNO_START+40) /* 370040 */ /** * @hideinitializer - * STUN mapped address attribute not found + * STUN IPv6 attribute not supported */ -#define PJNATH_ESTUNNOMAPPEDADDR (PJNATH_ERRNO_START+127)/* 370127 */ +#define PJNATH_ESTUNIPV6NOTSUPP (PJNATH_ERRNO_START+41) /* 370041 */ -//#define PJ_STATUS_FROM_STUN_CODE(code) (PJNATH_ERRNO_START+code) +/************************************************************ + * ICE ERROR CODES + ***********************************************************/ + /** * @hideinitializer - * No ICE checklist is formed. - */ -#define PJ_EICENOCHECKLIST -1 -/** - * @hideinitializer - * No suitable default ICE candidate for the component. + * ICE session not available */ -#define PJ_EICENOCAND -1 +#define PJNATH_ENOICE (PJNATH_ERRNO_START+80) /* 370080 */ /** * @hideinitializer - * Invalid ICE component ID + * ICE check is in progress */ -#define PJ_EICEINCOMPID -1 +#define PJNATH_EICEINPROGRESS (PJNATH_ERRNO_START+81) /* 370081 */ /** * @hideinitializer - * Invalid ICE candidate ID + * All ICE checklists failed */ -#define PJ_EICEINCANDID -1 +#define PJNATH_EICEFAILED (PJNATH_ERRNO_START+82) /* 370082 */ /** * @hideinitializer - * ICE session not available + * Invalid ICE component ID */ -#define PJ_ENOICE -1 +#define PJNATH_EICEINCOMPID (PJNATH_ERRNO_START+86) /* 370086 */ /** * @hideinitializer - * ICE check is in progress + * Invalid ICE candidate ID */ -#define PJ_EICEINPROGRESS -1 +#define PJNATH_EICEINCANDID (PJNATH_ERRNO_START+87) /* 370087 */ /** * @hideinitializer * Missing ICE SDP attribute */ -#define PJ_EICEMISSINGSDP -1 +#define PJNATH_EICEMISSINGSDP (PJNATH_ERRNO_START+90) /* 370090 */ /** * @hideinitializer * Invalid SDP "candidate" attribute */ -#define PJ_EICEINCANDSDP -1 +#define PJNATH_EICEINCANDSDP (PJNATH_ERRNO_START+91) /* 370091 */ diff --git a/pjnath/include/pjnath/ice.h b/pjnath/include/pjnath/ice.h index 8aa77cbc..10faa21f 100644 --- a/pjnath/include/pjnath/ice.h +++ b/pjnath/include/pjnath/ice.h @@ -96,7 +96,7 @@ typedef struct pj_ice_cand pj_uint32_t prio; pj_sockaddr addr; pj_sockaddr base_addr; - pj_sockaddr srv_addr; + pj_sockaddr rel_addr; pj_stun_session *stun_sess; } pj_ice_cand; @@ -204,20 +204,19 @@ struct pj_ice pj_ice_checklist clist; /* Valid list */ - unsigned valid_cnt; - unsigned valid_list[PJ_ICE_MAX_CHECKS]; + pj_ice_checklist valid_list; }; PJ_DECL(pj_status_t) pj_ice_create(pj_stun_config *stun_cfg, const char *name, pj_ice_role role, + unsigned comp_cnt, const pj_ice_cb *cb, const pj_str_t *local_ufrag, const pj_str_t *local_passwd, pj_ice **p_ice); PJ_DECL(pj_status_t) pj_ice_destroy(pj_ice *ice); -PJ_DECL(pj_status_t) pj_ice_add_comp(pj_ice *ice, unsigned comp_id); PJ_DECL(pj_status_t) pj_ice_add_cand(pj_ice *ice, unsigned comp_id, pj_ice_cand_type type, @@ -225,20 +224,13 @@ PJ_DECL(pj_status_t) pj_ice_add_cand(pj_ice *ice, const pj_str_t *foundation, const pj_sockaddr_t *addr, const pj_sockaddr_t *base_addr, - const pj_sockaddr_t *srv_addr, + const pj_sockaddr_t *rel_addr, int addr_len, unsigned *cand_id); -PJ_DECL(unsigned) pj_ice_get_cand_cnt(pj_ice *ice); -PJ_DECL(pj_status_t) pj_ice_enum_cands(pj_ice *ice, - unsigned *p_count, - unsigned cand_ids[]); -PJ_DECL(pj_status_t) pj_ice_get_default_cand(pj_ice *ice, - unsigned comp_id, - int *cand_id); -PJ_DECL(pj_status_t) pj_ice_get_cand(pj_ice *ice, - unsigned cand_id, - pj_ice_cand **p_cand); +PJ_DECL(pj_status_t) pj_ice_find_default_cand(pj_ice *ice, + unsigned comp_id, + int *cand_id); PJ_DECL(pj_status_t) pj_ice_create_check_list(pj_ice *ice, const pj_str_t *rem_ufrag, diff --git a/pjnath/include/pjnath/stun_msg.h b/pjnath/include/pjnath/stun_msg.h index 08e5672d..3362703c 100644 --- a/pjnath/include/pjnath/stun_msg.h +++ b/pjnath/include/pjnath/stun_msg.h @@ -383,7 +383,6 @@ typedef enum pj_stun_status PJ_STUN_SC_NO_BINDING = 437, /**< No Binding. */ PJ_STUN_SC_STALE_NONCE = 438, /**< Stale Nonce */ PJ_STUN_SC_TRANSITIONING = 439, /**< Transitioning. */ - PJ_STUN_SC_WRONG_USERNAME = 441, /**< Wrong Username. */ PJ_STUN_SC_UNSUPP_TRANSPORT_PROTO = 442, /**< Unsupported Transport or Protocol */ PJ_STUN_SC_INVALID_IP_ADDR = 443, /**< Invalid IP Address */ diff --git a/pjnath/include/pjnath/types.h b/pjnath/include/pjnath/types.h index d39da89e..0d9dc61c 100644 --- a/pjnath/include/pjnath/types.h +++ b/pjnath/include/pjnath/types.h @@ -29,8 +29,27 @@ /** * @defgroup PJNATH NAT Helper Library + * @{ */ +PJ_BEGIN_DECL + +/** + * Initialize pjnath library. + * + * @return Initialization status. + */ +PJ_DECL(pj_status_t) pjnath_init(void); + + +PJ_END_DECL + +/** + * @} + */ + +/* Doxygen documentation below: */ + /** * @mainpage NAT Helper Library * @@ -43,20 +62,6 @@ * Please go to the <A HREF="modules.htm"><B>Modules</B></A> page for list * of modules. * - * - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n - * \n */ #endif /* __PJNATH_TYPES_H__ */ |