summaryrefslogtreecommitdiff
path: root/res/res_pjsip_xpidf_body_generator.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-18 16:09:25 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-18 16:09:25 +0000
commit79eac1ffcaa419a2c21c43dc9f1c26dda92594f9 (patch)
tree1f3a9272d8a70d968e0401e9bcc2df524c7eb096 /res/res_pjsip_xpidf_body_generator.c
parent126334a7aa9a8ba27e5abe02f1a07e526675aab4 (diff)
res_pjsip_pubsub: Add some type safety when generating NOTIFY bodies.
res_pjsip_pubsub has two separate checks that it makes when a SUBSCRIBE arrives. * It checks that there is a subscription handler for the Event * It checks that there are body generators for the types in the Accept header The problem is, there's nothing that ensures that these two things will actually mesh with each other. For instance, Asterisk will accept a subscription to MWI that accepts pidf+xml bodies. That doesn't make sense. With this commit, we add some type information to the mix. Subscription handlers state they generate data of type X, and body generators state that they consume data of type X. This way, Asterisk doesn't end up in some hilariously mismatched situation like the one in the previous paragraph. ASTERISK-24136 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/3877 Review: https://reviewboard.asterisk.org/r/3878 ........ Merged revisions 423344 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423348 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_xpidf_body_generator.c')
-rw-r--r--res/res_pjsip_xpidf_body_generator.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/res/res_pjsip_xpidf_body_generator.c b/res/res_pjsip_xpidf_body_generator.c
index 38e036a7b..e7009afdf 100644
--- a/res/res_pjsip_xpidf_body_generator.c
+++ b/res/res_pjsip_xpidf_body_generator.c
@@ -125,6 +125,7 @@ static void xpidf_to_string(void *body, struct ast_str **str)
static struct ast_sip_pubsub_body_generator xpidf_body_generator = {
.type = "application",
.subtype = "xpidf+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = xpidf_allocate_body,
.generate_body_content = xpidf_generate_body_content,
.to_string = xpidf_to_string,
@@ -134,6 +135,7 @@ static struct ast_sip_pubsub_body_generator xpidf_body_generator = {
static struct ast_sip_pubsub_body_generator cpim_pidf_body_generator = {
.type = "application",
.subtype = "cpim-pidf+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = xpidf_allocate_body,
.generate_body_content = xpidf_generate_body_content,
.to_string = xpidf_to_string,