Skip to content

Commit f999022

Browse files
committed
Merge branch 'master' into v1.10
2 parents 7a921c6 + df01ad4 commit f999022

File tree

18 files changed

+345
-90
lines changed

18 files changed

+345
-90
lines changed

build/next-release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.10.0-release
1+
1.10.1-release

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
# Must change all of the below together
55
# For a release, set revision for that tagged release as well and uncomment
6-
AC_INIT([freeswitch], [1.10.0-release], [email protected])
6+
AC_INIT([freeswitch], [1.10.1-release], [email protected])
77
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
88
AC_SUBST(SWITCH_VERSION_MINOR, [10])
9-
AC_SUBST(SWITCH_VERSION_MICRO, [0-release])
9+
AC_SUBST(SWITCH_VERSION_MICRO, [1-release])
1010
AC_SUBST(SWITCH_VERSION_REVISION, [])
1111
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
1212

libs/sofia-sip/.update

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Wed Jul 17 14:35:37 EDT 2019
1+
Mon Aug 19 16:25:57 CDT 2019

libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,3 +2797,118 @@ char const *sip_via_port(sip_via_t const *v, int *using_rport)
27972797
else
27982798
return SIP_DEFAULT_SERV; /* 5060 */
27992799
}
2800+
2801+
/**@SIP_HEADER sip_identity Identity Header
2802+
*
2803+
* The Identity header field specifies the "logical" recipient of the
2804+
* request. It is defined in @RFC8224 with semantics shown below,
2805+
* though for now it's parsed to a single 'value' field.
2806+
*
2807+
* @code
2808+
* Identity = "Identity" HCOLON signed-identity-digest SEMI
2809+
* ident-info *( SEMI ident-info-params )
2810+
* signed-identity-digest = 1*(base64-char / ".")
2811+
* ident-info = "info" EQUAL ident-info-uri
2812+
* ident-info-uri = LAQUOT absoluteURI RAQUOT
2813+
* ident-info-params = ident-info-alg / ident-type /
2814+
* ident-info-extension
2815+
* ident-info-alg = "alg" EQUAL token
2816+
* ident-type = "ppt" EQUAL token
2817+
* ident-info-extension = generic-param
2818+
*
2819+
* base64-char = ALPHA / DIGIT / "/" / "+"
2820+
* @endcode
2821+
*
2822+
* The parsed Identity header is stored in #sip_identity_t structure.
2823+
*/
2824+
2825+
/**@ingroup sip_identity
2826+
* @typedef typedef struct sip_identity_s sip_identity_t;
2827+
*
2828+
* The structure #sip_identity_t contains representation of @Identity header.
2829+
*
2830+
* The #sip_identity_t is defined as follows:
2831+
* @code
2832+
* typedef struct {
2833+
* sip_common_t id_common[1]; // Common fragment info
2834+
* sip_error_t *id_next; // Link to next (dummy)
2835+
* char const *id_value; // Identity
2836+
* char const *id_info; // Info param containing URL of the cert, with no '<','>'
2837+
* } sip_identity_t;
2838+
* @endcode
2839+
*
2840+
*/
2841+
2842+
static msg_xtra_f sip_identity_dup_xtra;
2843+
static msg_dup_f sip_identity_dup_one;
2844+
static msg_update_f sip_identity_update;
2845+
2846+
msg_hclass_t sip_identity_class[] =
2847+
SIP_HEADER_CLASS(identity, "Identity", "", id_common, single, identity);
2848+
2849+
issize_t sip_identity_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
2850+
{
2851+
sip_identity_t *id = (sip_identity_t *)h;
2852+
char const *p = NULL, *pp = NULL, *ppp = NULL, *ie = NULL;
2853+
char *result = NULL;
2854+
size_t len = 0;
2855+
2856+
id->id_value = strdup(s);
2857+
id->id_info = NULL;
2858+
2859+
p = strstr(s, "info=");
2860+
if (p) {
2861+
2862+
ie = strchr(p, ';');
2863+
pp = strchr(p, '<');
2864+
ppp = strchr(p, '>');
2865+
2866+
// allow for a spaces between "info=" and opening '<'
2867+
// extract URI from inside "<>" but allow empty - let the higher level app decide what to do about it
2868+
if (ie && pp && ppp && (pp < ppp) && (ppp < ie)) {
2869+
2870+
len = ppp - pp;
2871+
if ((result = malloc(len))) {
2872+
memcpy(result, pp + 1, len - 1);
2873+
result[len - 1] = '\0';
2874+
id->id_info = result;
2875+
}
2876+
}
2877+
}
2878+
2879+
return 0;
2880+
}
2881+
2882+
issize_t sip_identity_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
2883+
{
2884+
sip_identity_t const *id = (sip_identity_t *)h;
2885+
2886+
return snprintf(b, bsiz, "%s", id->id_value);
2887+
}
2888+
2889+
isize_t sip_identity_dup_xtra(sip_header_t const *h, isize_t offset)
2890+
{
2891+
sip_identity_t const *id = (sip_identity_t *)h;
2892+
return offset + MSG_STRING_SIZE(id->id_value);
2893+
}
2894+
2895+
char *sip_identity_dup_one(sip_header_t *dst, sip_header_t const *src,
2896+
char *b, isize_t xtra)
2897+
{
2898+
sip_identity_t *id = (sip_identity_t *)dst;
2899+
sip_identity_t const *o = (sip_identity_t *)src;
2900+
2901+
MSG_STRING_DUP(b, id->id_value, o->id_value);
2902+
2903+
return b;
2904+
}
2905+
2906+
static int sip_identity_update(msg_common_t *h,
2907+
char const *name, isize_t namelen,
2908+
char const *value)
2909+
{
2910+
sip_identity_t *id = (sip_identity_t *)h;
2911+
2912+
id->id_value = strdup(value);
2913+
return 0;
2914+
}

libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,23 @@ char const sip_version_2_0[] = "SIP/2.0";
6464
extern msg_mclass_t sip_mclass[];
6565

6666
static msg_mclass_t const *_default = sip_mclass;
67+
static msg_mclass_t *_default_parser_cloned = NULL;
6768

6869
/** Return a built-in SIP parser object. */
6970
msg_mclass_t const *sip_default_mclass(void)
7071
{
7172
return _default;
7273
}
7374

75+
/** Release SIP parser object if it was cloned. */
76+
void sip_cloned_parser_destroy(void)
77+
{
78+
if (_default_parser_cloned) {
79+
free(_default_parser_cloned);
80+
_default_parser_cloned = NULL;
81+
}
82+
}
83+
7484
/** Update the default SIP parser.
7585
*
7686
* Use the extended SIP parser as default one.
@@ -128,10 +138,12 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
128138
{
129139
msg_mclass_t *mclass;
130140

131-
if (input == NULL || input == _default)
132-
mclass = msg_mclass_clone(_default, 0, 0);
133-
else
141+
if (input == NULL || input == _default) {
142+
_default_parser_cloned = msg_mclass_clone(_default, 0, 0);
143+
mclass = _default_parser_cloned;
144+
} else {
134145
mclass = input;
146+
}
135147

136148
if (mclass) {
137149
extern msg_hclass_t * const sip_extensions[];
@@ -143,8 +155,10 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
143155
continue;
144156

145157
if (msg_mclass_insert_header(mclass, hclass, 0) < 0) {
146-
if (input != mclass)
158+
if (input != mclass) {
147159
free(mclass);
160+
_default_parser_cloned = NULL;
161+
}
148162
return mclass = NULL;
149163
}
150164
}

libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ typedef msg_list_t sip_allow_events_t;
215215
/* RFC 3323 - @Privacy */
216216
typedef struct sip_privacy_s sip_privacy_t;
217217

218+
/* SIP Identity Header, e.g. STIR-Shaken SIP Identity Header, RFC 8224 */
219+
typedef struct sip_identity_s sip_identity_t;
220+
218221
/* RFC 3327 - @Path */
219222
typedef struct sip_route_s sip_path_t;
220223

@@ -259,6 +262,7 @@ struct sip_s {
259262
sip_to_t *sip_to; /**< To (t) */
260263
sip_call_id_t *sip_call_id; /**< Call-ID (i) */
261264
sip_cseq_t *sip_cseq; /**< CSeq */
265+
sip_identity_t *sip_identity; /**< Identity */
262266
sip_contact_t *sip_contact; /**< Contact (m) */
263267
sip_rseq_t *sip_rseq; /**< RSeq */
264268
sip_rack_t *sip_rack; /**< RAck */
@@ -474,6 +478,17 @@ struct sip_cseq_s
474478
char const *cs_method_name; /**< Method name */
475479
};
476480

481+
/**@ingroup sip_identity
482+
* @brief Structure for @Identity SIP header.
483+
*/
484+
struct sip_identity_s
485+
{
486+
sip_common_t id_common[1]; /**< Common fragment info */
487+
sip_error_t *id_next; /**< Link to next (dummy) */
488+
char const *id_value; /**< Identity text as shown in SIP Header */
489+
char const *id_info; /**< Info param containing URL of the cert */
490+
};
491+
477492
/**@ingroup sip_contact
478493
* @brief Structure for @Contact header field.
479494
*/
@@ -920,6 +935,7 @@ union sip_header_u
920935

921936
sip_separator_t sh_separator[1];
922937
sip_payload_t sh_payload[1];
938+
sip_identity_t sh_identity[1];
923939
};
924940

925941
SOFIA_END_DECLS

libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ SOFIA_BEGIN_DECLS
6060
/** Return a built-in SIP parser object. */
6161
SOFIAPUBFUN msg_mclass_t const *sip_default_mclass(void);
6262

63+
/** Release SIP parser object if it was cloned. */
64+
SOFIAPUBFUN void sip_cloned_parser_destroy(void);
65+
6366
SOFIAPUBFUN int sip_update_default_mclass(msg_mclass_t const *mclass);
6467
SOFIAPUBFUN msg_mclass_t *sip_extend_mclass(msg_mclass_t *input);
6568

@@ -224,6 +227,10 @@ SOFIAPUBFUN sip_call_id_t *sip_call_id_create(su_home_t *home,
224227
SOFIAPUBFUN sip_cseq_t *sip_cseq_create(su_home_t *, uint32_t seq,
225228
unsigned method, char const *name);
226229

230+
/** Create a @Identity header object. */
231+
SOFIAPUBFUN sip_identity_t *sip_identity_create(su_home_t *, uint32_t seq,
232+
unsigned method, char const *name);
233+
227234
/** Create a @Contact header object. */
228235
SOFIAPUBFUN sip_contact_t * sip_contact_create(su_home_t *,
229236
url_string_t const *url,

0 commit comments

Comments
 (0)