WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB-UTIL Reference

String Escaping Utilities

Functions

pj_str_t pj_str_unescape (pj_pool_t *pool, const pj_str_t *src)
 
pj_str_tpj_strcpy_unescape (pj_str_t *dst, const pj_str_t *src)
 
pj_str_tpj_strncpy_escape (pj_str_t *dst, const pj_str_t *src, pj_ssize_t max, const pj_cis_t *unres)
 
pj_ssize_t pj_strncpy2_escape (char *dst, const pj_str_t *src, pj_ssize_t max, const pj_cis_t *unres)
 

Detailed Description

Function Documentation

◆ pj_str_unescape()

pj_str_t pj_str_unescape ( pj_pool_t pool,
const pj_str_t src 
)

Unescape string. If source string does not contain any escaped characters, the function would simply return the original string. Otherwise a new string will be allocated.

Parameters
poolPool to allocate the string.
srcSource string to unescape.
Returns
String with no escaped characters.

◆ pj_strcpy_unescape()

pj_str_t * pj_strcpy_unescape ( pj_str_t dst,
const pj_str_t src 
)

Unescape string to destination.

Parameters
dstTarget string.
srcSource string.
Returns
Target string.

◆ pj_strncpy2_escape()

pj_ssize_t pj_strncpy2_escape ( char *  dst,
const pj_str_t src,
pj_ssize_t  max,
const pj_cis_t unres 
)

Copy string to destination while escaping reserved characters, up to the specified maximum length.

Parameters
dstTarget string.
srcSource string.
maxMaximum length to copy to target string.
unresUnreserved characters, which are allowed to appear unescaped.
Returns
The length of the destination, or -1 if there's not enough buffer.

References PJ_END_DECL.

◆ pj_strncpy_escape()

pj_str_t * pj_strncpy_escape ( pj_str_t dst,
const pj_str_t src,
pj_ssize_t  max,
const pj_cis_t unres 
)

Copy string to destination while escaping reserved characters, up to the specified maximum length.

Parameters
dstTarget string.
srcSource string.
maxMaximum length to copy to target string.
unresUnreserved characters, which are allowed to appear unescaped.
Returns
The target string if all characters have been copied successfully, or NULL if there's not enough buffer to escape the strings.

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.