Close #2067: Fix linker error when building as dll on VS2015.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@5701 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
96b5e742e0
commit
054ae59549
|
@ -930,9 +930,9 @@ PJ_DEF(pj_status_t) pj_http_req_create(pj_pool_t *pool,
|
|||
* drawback would be that you can't use this if the method is not
|
||||
* officially supported
|
||||
*/
|
||||
PJ_ASSERT_RETURN(hreq->param.addr_family==PJ_AF_UNSPEC ||
|
||||
hreq->param.addr_family==PJ_AF_INET ||
|
||||
hreq->param.addr_family==PJ_AF_INET6, PJ_EAFNOTSUP);
|
||||
PJ_ASSERT_RETURN(hreq->param.addr_family==pj_AF_UNSPEC() ||
|
||||
hreq->param.addr_family==pj_AF_INET() ||
|
||||
hreq->param.addr_family==pj_AF_INET6(), PJ_EAFNOTSUP);
|
||||
PJ_ASSERT_RETURN(!pj_strcmp2(&hreq->param.version, HTTP_1_0) ||
|
||||
!pj_strcmp2(&hreq->param.version, HTTP_1_1),
|
||||
PJ_ENOTSUP);
|
||||
|
|
|
@ -76,7 +76,7 @@ PJ_DEF(pj_ssize_t) pj_strcspn(const pj_str_t *str, const pj_str_t *set_char)
|
|||
}
|
||||
|
||||
|
||||
PJ_DECL(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char)
|
||||
PJ_DEF(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char)
|
||||
{
|
||||
pj_ssize_t i, j;
|
||||
for (i = 0; i < str->slen; i++) {
|
||||
|
@ -114,7 +114,7 @@ PJ_DEF(pj_ssize_t) pj_strtok(const pj_str_t *str, const pj_str_t *delim,
|
|||
}
|
||||
|
||||
|
||||
PJ_DECL(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim,
|
||||
PJ_DEF(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim,
|
||||
pj_str_t *tok, pj_size_t start_idx)
|
||||
{
|
||||
pj_ssize_t str_idx;
|
||||
|
|
|
@ -820,11 +820,10 @@ static pj_status_t parse_args(int argc, char *argv[],
|
|||
case OPT_USE_COMPACT_FORM:
|
||||
/* enable compact form - from Ticket #342 */
|
||||
{
|
||||
extern pj_bool_t pjsip_use_compact_form;
|
||||
extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
|
||||
extern pj_bool_t pjmedia_add_rtpmap_for_static_pt;
|
||||
|
||||
pjsip_use_compact_form = PJ_TRUE;
|
||||
pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;
|
||||
/* do not transmit Allow header */
|
||||
pjsip_include_allow_hdr_in_dlg = PJ_FALSE;
|
||||
/* Do not include rtpmap for static payload types (<96) */
|
||||
|
@ -1747,7 +1746,6 @@ int write_settings(pjsua_app_config *config, char *buf, pj_size_t max)
|
|||
unsigned i;
|
||||
pj_str_t cfg;
|
||||
char line[128];
|
||||
extern pj_bool_t pjsip_use_compact_form;
|
||||
|
||||
PJ_UNUSED_ARG(max);
|
||||
|
||||
|
@ -2147,7 +2145,7 @@ int write_settings(pjsua_app_config *config, char *buf, pj_size_t max)
|
|||
pj_strcat2(&cfg, "--norefersub\n");
|
||||
}
|
||||
|
||||
if (pjsip_use_compact_form)
|
||||
if (pjsip_cfg()->endpt.use_compact_form)
|
||||
{
|
||||
pj_strcat2(&cfg, "--use-compact-form\n");
|
||||
}
|
||||
|
|
|
@ -157,6 +157,19 @@ typedef struct pjsip_cfg_t
|
|||
*/
|
||||
pj_bool_t disable_secure_dlg_check;
|
||||
|
||||
/**
|
||||
* Encode SIP headers in their short forms to reduce size. By default,
|
||||
* SIP headers in outgoing messages will be encoded in their full names.
|
||||
* If this option is enabled, then SIP headers for outgoing messages
|
||||
* will be encoded in their short forms, to reduce message size.
|
||||
* Note that this does not affect the ability of PJSIP to parse incoming
|
||||
* SIP messages, as the parser always supports parsing both the long
|
||||
* and short version of the headers.
|
||||
*
|
||||
* Default is PJSIP_ENCODE_SHORT_HNAME
|
||||
*/
|
||||
pj_bool_t use_compact_form;
|
||||
|
||||
} endpt;
|
||||
|
||||
/** Transaction layer settings. */
|
||||
|
@ -464,18 +477,8 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
|
|||
* SIP messages, as the parser always supports parsing both the long
|
||||
* and short version of the headers.
|
||||
*
|
||||
* Note that there is also an undocumented variable defined in sip_msg.c
|
||||
* to control whether compact form should be used for encoding SIP
|
||||
* headers. The default value of this variable is PJSIP_ENCODE_SHORT_HNAME.
|
||||
* To change PJSIP behavior during run-time, application can use the
|
||||
* following construct:
|
||||
*
|
||||
\verbatim
|
||||
extern pj_bool_t pjsip_use_compact_form;
|
||||
|
||||
// enable compact form
|
||||
pjsip_use_compact_form = PJ_TRUE;
|
||||
\endverbatim
|
||||
* This option can also be controlled at run-time by the
|
||||
* \a use_compact_form setting in pjsip_cfg_t.
|
||||
*
|
||||
* Default is 0 (no)
|
||||
*/
|
||||
|
|
|
@ -86,7 +86,7 @@ PJ_DEF(pj_status_t) pjsip_pres_create_pidf( pj_pool_t *pool,
|
|||
if (status->info[i].id.slen == 0) {
|
||||
/* xs:ID must start with letter */
|
||||
//pj_create_unique_string(pool, &id);
|
||||
id.ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH+2);
|
||||
id.ptr = (char*)pj_pool_alloc(pool, pj_GUID_STRING_LENGTH()+2);
|
||||
id.ptr += 2;
|
||||
pj_generate_unique_string(&id);
|
||||
id.ptr -= 2;
|
||||
|
|
|
@ -149,7 +149,7 @@ PJ_DEF(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
|
|||
pj_str_t person_id;
|
||||
/* xs:ID must start with letter */
|
||||
//pj_create_unique_string(pool, &person_id);
|
||||
person_id.ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH+2);
|
||||
person_id.ptr = (char*)pj_pool_alloc(pool, pj_GUID_STRING_LENGTH()+2);
|
||||
person_id.ptr += 2;
|
||||
pj_generate_unique_string(&person_id);
|
||||
person_id.ptr -= 2;
|
||||
|
|
|
@ -4664,7 +4664,7 @@ static void inv_on_state_connecting( pjsip_inv_session *inv, pjsip_event *e)
|
|||
|
||||
} else if (tsx->role == PJSIP_ROLE_UAS &&
|
||||
tsx->state == PJSIP_TSX_STATE_TRYING &&
|
||||
pjsip_method_cmp(&tsx->method, &pjsip_invite_method)==0)
|
||||
pjsip_method_cmp(&tsx->method, pjsip_get_invite_method())==0)
|
||||
{
|
||||
pjsip_rx_data *rdata = e->body.tsx_state.src.rdata;
|
||||
pjsip_tx_data *tdata;
|
||||
|
|
|
@ -70,9 +70,6 @@ struct pjsip_timer
|
|||
refresher */
|
||||
};
|
||||
|
||||
/* External global vars */
|
||||
extern pj_bool_t pjsip_use_compact_form;
|
||||
|
||||
/* Local functions & vars */
|
||||
static void stop_timer(pjsip_inv_session *inv);
|
||||
static void start_timer(pjsip_inv_session *inv);
|
||||
|
@ -124,7 +121,8 @@ static int se_hdr_print(pjsip_sess_expires_hdr *hdr,
|
|||
char *endbuf = buf+size;
|
||||
pj_ssize_t printed;
|
||||
const pjsip_parser_const_t *pc = pjsip_parser_const();
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
/* Print header name and value */
|
||||
if ((endbuf - p) < (hname->slen + 16))
|
||||
|
|
|
@ -34,7 +34,8 @@ pjsip_cfg_t pjsip_sip_cfg_var =
|
|||
PJSIP_FOLLOW_EARLY_MEDIA_FORK,
|
||||
PJSIP_REQ_HAS_VIA_ALIAS,
|
||||
PJSIP_RESOLVE_HOSTNAME_TO_GET_INTERFACE,
|
||||
0
|
||||
0,
|
||||
PJSIP_ENCODE_SHORT_HNAME
|
||||
},
|
||||
|
||||
/* Transaction settings */
|
||||
|
|
|
@ -144,8 +144,6 @@ const pjsip_hdr_name_info_t pjsip_hdr_names[] =
|
|||
{ "_Unknown-Header", 15, NULL }, // PJSIP_H_OTHER,
|
||||
};
|
||||
|
||||
pj_bool_t pjsip_use_compact_form = PJSIP_ENCODE_SHORT_HNAME;
|
||||
|
||||
static pj_str_t status_phrase[710];
|
||||
static int print_media_type(char *buf, unsigned len,
|
||||
const pjsip_media_type *media);
|
||||
|
@ -403,7 +401,7 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,
|
|||
pjsip_hdr *hdr;
|
||||
pj_str_t clen_hdr = { "Content-Length: ", 16};
|
||||
|
||||
if (pjsip_use_compact_form) {
|
||||
if (pjsip_cfg()->endpt.use_compact_form) {
|
||||
clen_hdr.ptr = "l: ";
|
||||
clen_hdr.slen = 3;
|
||||
}
|
||||
|
@ -486,7 +484,7 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,
|
|||
pj_str_t ctype_hdr = { "Content-Type: ", 14};
|
||||
const pjsip_media_type *media = &msg->body->content_type;
|
||||
|
||||
if (pjsip_use_compact_form) {
|
||||
if (pjsip_cfg()->endpt.use_compact_form) {
|
||||
ctype_hdr.ptr = "c: ";
|
||||
ctype_hdr.slen = 3;
|
||||
}
|
||||
|
@ -749,7 +747,8 @@ static int pjsip_generic_string_hdr_print( pjsip_generic_string_hdr *hdr,
|
|||
char *buf, pj_size_t size)
|
||||
{
|
||||
char *p = buf;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
if ((pj_ssize_t)size < hname->slen + hdr->hvalue.slen + 5)
|
||||
return -1;
|
||||
|
@ -832,7 +831,8 @@ static int pjsip_generic_int_hdr_print( pjsip_generic_int_hdr *hdr,
|
|||
char *buf, pj_size_t size)
|
||||
{
|
||||
char *p = buf;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
if ((pj_ssize_t)size < hname->slen + 15)
|
||||
return -1;
|
||||
|
@ -908,7 +908,8 @@ static int pjsip_generic_array_hdr_print( pjsip_generic_array_hdr *hdr,
|
|||
char *buf, pj_size_t size)
|
||||
{
|
||||
char *p = buf, *endbuf = buf+size;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
copy_advance(p, (*hname));
|
||||
*p++ = ':';
|
||||
|
@ -1057,7 +1058,8 @@ static int pjsip_clen_hdr_print( pjsip_clen_hdr *hdr,
|
|||
{
|
||||
char *p = buf;
|
||||
int len;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
if ((pj_ssize_t)size < hname->slen + 14)
|
||||
return -1;
|
||||
|
@ -1200,7 +1202,8 @@ PJ_DEF(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool )
|
|||
static int pjsip_contact_hdr_print( pjsip_contact_hdr *hdr, char *buf,
|
||||
pj_size_t size)
|
||||
{
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
const pjsip_parser_const_t *pc = pjsip_parser_const();
|
||||
|
||||
if (hdr->star) {
|
||||
|
@ -1374,7 +1377,8 @@ static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr,
|
|||
{
|
||||
char *p = buf;
|
||||
int len;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
|
||||
if ((pj_ssize_t)size < hname->slen +
|
||||
hdr->media.type.slen + hdr->media.subtype.slen + 8)
|
||||
|
@ -1514,7 +1518,8 @@ static int pjsip_fromto_hdr_print( pjsip_fromto_hdr *hdr,
|
|||
pj_ssize_t printed;
|
||||
char *startbuf = buf;
|
||||
char *endbuf = buf + size;
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
const pjsip_parser_const_t *pc = pjsip_parser_const();
|
||||
|
||||
copy_advance(buf, (*hname));
|
||||
|
@ -1984,7 +1989,8 @@ static int pjsip_via_hdr_print( pjsip_via_hdr *hdr,
|
|||
char *startbuf = buf;
|
||||
char *endbuf = buf + size;
|
||||
pj_str_t sip_ver = { "SIP/2.0/", 8 };
|
||||
const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
|
||||
const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form?
|
||||
&hdr->sname : &hdr->name;
|
||||
const pjsip_parser_const_t *pc = pjsip_parser_const();
|
||||
|
||||
if ((pj_ssize_t)size < hname->slen + sip_ver.slen +
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
# define TRACE_(x)
|
||||
#endif
|
||||
|
||||
extern pj_bool_t pjsip_use_compact_form;
|
||||
|
||||
/* Type of "data" in multipart pjsip_msg_body */
|
||||
struct multipart_data
|
||||
{
|
||||
|
@ -105,7 +103,7 @@ static int multipart_print_body(struct pjsip_msg_body *msg_body,
|
|||
pj_str_t ctype_hdr = { "Content-Type: ", 14};
|
||||
const pjsip_media_type *media = &part->body->content_type;
|
||||
|
||||
if (pjsip_use_compact_form) {
|
||||
if (pjsip_cfg()->endpt.use_compact_form) {
|
||||
ctype_hdr.ptr = "c: ";
|
||||
ctype_hdr.slen = 3;
|
||||
}
|
||||
|
|
|
@ -1423,7 +1423,7 @@ static pj_status_t get_net_interface(pjsip_transport_type_e tp_type,
|
|||
pj_sockaddr itf_addr;
|
||||
pj_status_t status = -1;
|
||||
|
||||
af = (tp_type & PJSIP_TRANSPORT_IPV6)? PJ_AF_INET6 : PJ_AF_INET;
|
||||
af = (tp_type & PJSIP_TRANSPORT_IPV6)? pj_AF_INET6() : pj_AF_INET();
|
||||
|
||||
if (pjsip_cfg()->endpt.resolve_hostname_to_get_interface) {
|
||||
status = pj_getipinterface(af, dst, &itf_addr, PJ_TRUE, NULL);
|
||||
|
|
|
@ -3872,7 +3872,7 @@ pjsip_dialog* on_dlg_forked(pjsip_dialog *dlg, pjsip_rx_data *res)
|
|||
pjsip_dlg_inc_lock(forked_dlg);
|
||||
|
||||
/* Disconnect the call */
|
||||
status = pjsip_dlg_create_request(forked_dlg, &pjsip_bye_method,
|
||||
status = pjsip_dlg_create_request(forked_dlg, pjsip_get_bye_method(),
|
||||
-1, &bye);
|
||||
if (status == PJ_SUCCESS) {
|
||||
status = pjsip_dlg_send_request(forked_dlg, bye, -1, NULL);
|
||||
|
@ -4498,7 +4498,7 @@ static void xfer_client_on_evsub_state( pjsip_evsub *sub, pjsip_event *event)
|
|||
if (status_line.code/100 == 2 && !is_last) {
|
||||
pjsip_tx_data *tdata;
|
||||
|
||||
status = pjsip_evsub_initiate(sub, &pjsip_subscribe_method,
|
||||
status = pjsip_evsub_initiate(sub, pjsip_get_subscribe_method(),
|
||||
0, &tdata);
|
||||
if (status == PJ_SUCCESS)
|
||||
status = pjsip_evsub_send_request(sub, tdata);
|
||||
|
@ -4891,7 +4891,7 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv,
|
|||
}
|
||||
}
|
||||
} else if (tsx->role == PJSIP_ROLE_UAC &&
|
||||
pjsip_method_cmp(&tsx->method, &pjsip_invite_method)==0 &&
|
||||
pjsip_method_cmp(&tsx->method, pjsip_get_invite_method())==0 &&
|
||||
tsx->state >= PJSIP_TSX_STATE_COMPLETED &&
|
||||
e->body.tsx_state.prev_state < PJSIP_TSX_STATE_COMPLETED &&
|
||||
(!PJSIP_IS_STATUS_IN_CLASS(tsx->status_code, 300) &&
|
||||
|
|
|
@ -1577,7 +1577,7 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event)
|
|||
if (event && event->type==PJSIP_EVENT_TSX_STATE) {
|
||||
const pjsip_transaction *tsx = event->body.tsx_state.tsx;
|
||||
if (pjsip_method_cmp(&tsx->method,
|
||||
&pjsip_subscribe_method)==0)
|
||||
pjsip_get_subscribe_method())==0)
|
||||
{
|
||||
buddy->term_code = tsx->status_code;
|
||||
switch (tsx->status_code) {
|
||||
|
@ -1596,7 +1596,7 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event)
|
|||
break;
|
||||
}
|
||||
} else if (pjsip_method_cmp(&tsx->method,
|
||||
&pjsip_notify_method)==0)
|
||||
pjsip_get_notify_method())==0)
|
||||
{
|
||||
if (pj_stricmp2(&buddy->term_reason, "deactivated")==0 ||
|
||||
pj_stricmp2(&buddy->term_reason, "timeout")==0) {
|
||||
|
@ -2275,7 +2275,8 @@ static pj_bool_t unsolicited_mwi_on_rx_request(pjsip_rx_data *rdata)
|
|||
pj_str_t MWI = { "message-summary", 15 };
|
||||
pjsip_event_hdr *eh;
|
||||
|
||||
if (pjsip_method_cmp(&msg->line.req.method, &pjsip_notify_method)!=0) {
|
||||
if (pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())!=0)
|
||||
{
|
||||
/* Only interested with NOTIFY request */
|
||||
return PJ_FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue