📄 sip_endpoint.h
字号:
/** * Create a new transmit data buffer. * This function, like all other endpoint functions, is thread safe. * * @param endpt The endpoint. * @param p_tdata Pointer to receive transmit data buffer. * * @return PJ_SUCCESS or the appropriate error code. */PJ_DECL(pj_status_t) pjsip_endpt_create_tdata( pjsip_endpoint *endpt, pjsip_tx_data **p_tdata);/** * Create the DNS resolver instance. Application creates the DNS * resolver instance, set the nameserver to be used by the DNS * resolver, then set the DNS resolver to be used by the endpoint * by calling #pjsip_endpt_set_resolver(). * * @param endpt The SIP endpoint instance. * @param p_resv Pointer to receive the DNS resolver instance. * * @return PJ_SUCCESS on success, or the appropriate error * code. */PJ_DECL(pj_status_t) pjsip_endpt_create_resolver(pjsip_endpoint *endpt, pj_dns_resolver **p_resv);/** * Set DNS resolver to be used by the SIP resolver. Application can set * the resolver instance to NULL to disable DNS resolution (perhaps * temporarily). When DNS resolver is disabled, the endpoint will resolve * hostnames with the normal pj_gethostbyname() function. * * @param endpt The SIP endpoint instance. * @param resv The resolver instance to be used by the SIP * endpoint. * * @return PJ_SUCCESS on success, or the appropriate error * code. */PJ_DECL(pj_status_t) pjsip_endpt_set_resolver(pjsip_endpoint *endpt, pj_dns_resolver *resv);/** * Get the DNS resolver being used by the SIP resolver. * * @param endpt The SIP endpoint instance. * * @return The DNS resolver instance currently being used * by the SIP endpoint. */PJ_DECL(pj_dns_resolver*) pjsip_endpt_get_resolver(pjsip_endpoint *endpt);/** * Asynchronously resolve a SIP target host or domain according to rule * specified in RFC 3263 (Locating SIP Servers). When the resolving operation * has completed, the callback will be called. * * @param endpt The endpoint instance. * @param pool The pool to allocate resolver job. * @param target The target specification to be resolved. * @param token A user defined token to be passed back to callback function. * @param cb The callback function. */PJ_DECL(void) pjsip_endpt_resolve( pjsip_endpoint *endpt, pj_pool_t *pool, pjsip_host_info *target, void *token, pjsip_resolver_callback *cb);/** * Get transport manager instance. * * @param endpt The endpoint. * * @return Transport manager instance. */PJ_DECL(pjsip_tpmgr*) pjsip_endpt_get_tpmgr(pjsip_endpoint *endpt);/** * Get ioqueue instance. * * @param endpt The endpoint. * * @return The ioqueue. */PJ_DECL(pj_ioqueue_t*) pjsip_endpt_get_ioqueue(pjsip_endpoint *endpt);/** * Find a SIP transport suitable for sending SIP message to the specified * address. If transport selector ("sel") is set, then the function will * check if the transport selected is suitable to send requests to the * specified address. * * @see pjsip_tpmgr_acquire_transport * * @param endpt The SIP endpoint instance. * @param type The type of transport to be acquired. * @param remote The remote address to send message to. * @param addr_len Length of the remote address. * @param sel Optional pointer to transport selector instance which is * used to find explicit transport, if required. * @param p_tp Pointer to receive the transport instance, if one is found. * * @return PJ_SUCCESS on success, or the appropriate error code. */PJ_DECL(pj_status_t) pjsip_endpt_acquire_transport( pjsip_endpoint *endpt, pjsip_transport_type_e type, const pj_sockaddr_t *remote, int addr_len, const pjsip_tpselector *sel, pjsip_transport **p_tp);/***************************************************************************** * * Capabilities Management * * Modules may implement new capabilities to the stack. These capabilities * are indicated by the appropriate SIP header fields, such as Accept, * Accept-Encoding, Accept-Language, Allow, Supported, etc. * * When a module provides new capabilities to the stack, it registers these * capabilities to the endpoint by supplying new tags (strings) to the * appropriate header fields. Application (or other modules) can then query * these header fields to get the list of supported capabilities, and may * include these headers in the outgoing message. ***************************************************************************** *//** * Get the value of the specified capability header field. * * @param endpt The endpoint. * @param htype The header type to be retrieved, which value may be: * - PJSIP_H_ACCEPT * - PJSIP_H_ALLOW * - PJSIP_H_SUPPORTED * @param hname If htype specifies PJSIP_H_OTHER, then the header name * must be supplied in this argument. Otherwise the value * must be set to NULL. * * @return The appropriate header, or NULL if the header is not * available. */PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_capability( pjsip_endpoint *endpt, int htype, const pj_str_t *hname);/** * Check if we have the specified capability. * * @param endpt The endpoint. * @param htype The header type to be retrieved, which value may be: * - PJSIP_H_ACCEPT * - PJSIP_H_ALLOW * - PJSIP_H_SUPPORTED * @param hname If htype specifies PJSIP_H_OTHER, then the header name * must be supplied in this argument. Otherwise the value * must be set to NULL. * @param token The capability token to check. For example, if \a htype * is PJSIP_H_ALLOW, then \a token specifies the method * names; if \a htype is PJSIP_H_SUPPORTED, then \a token * specifies the extension names such as "100rel". * * @return PJ_TRUE if the specified capability is supported, * otherwise PJ_FALSE.. */PJ_DECL(pj_bool_t) pjsip_endpt_has_capability( pjsip_endpoint *endpt, int htype, const pj_str_t *hname, const pj_str_t *token);/** * Add or register new capabilities as indicated by the tags to the * appropriate header fields in the endpoint. * * @param endpt The endpoint. * @param mod The module which registers the capability. * @param htype The header type to be set, which value may be: * - PJSIP_H_ACCEPT * - PJSIP_H_ALLOW * - PJSIP_H_SUPPORTED * @param hname If htype specifies PJSIP_H_OTHER, then the header name * must be supplied in this argument. Otherwise the value * must be set to NULL. * @param count The number of tags in the array. * @param tags Array of tags describing the capabilities or extensions * to be added to the appropriate header. * * @return PJ_SUCCESS on success. */PJ_DECL(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt, pjsip_module *mod, int htype, const pj_str_t *hname, unsigned count, const pj_str_t tags[]);/** * Get list of additional headers to be put in outgoing request message. * Currently only Max-Forwards are defined. * * @param e The endpoint. * * @return List of headers. */PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *e);/** * Dump endpoint status to the log. This will print the status to the log * with log level 3. * * @param endpt The endpoint. * @param detail If non zero, then it will dump a detailed output. * BEWARE that this option may crash the system because * it tries to access all memory pools. */PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail );/** * @} *//** * Log an error. */PJ_DECL(void) pjsip_endpt_log_error( pjsip_endpoint *endpt, const char *sender, pj_status_t error_code, const char *format, ... );#define PJSIP_ENDPT_LOG_ERROR(expr) \ pjsip_endpt_log_error expr#define PJSIP_ENDPT_TRACE(tracing,expr) \ do { \ if ((tracing)) \ PJ_LOG(4,expr); \ } while (0)/* * Internal functions. *//* * Receive transaction events from transactions and put in the event queue * to be processed later. */void pjsip_endpt_send_tsx_event( pjsip_endpoint *endpt, pjsip_event *evt );PJ_END_DECL#endif /* __PJSIP_SIP_ENDPOINT_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -