Commit d73ef87f authored by Pekka Pessi's avatar Pekka Pessi

sip: added Suppress-Body-If-Match and Suppress-Notify-If-Match headers.

Fixed Refer-Sub header documentation.

darcs-hash:20061220121228-65a35-3e9b36baf80fdc5c58ca5109466daf0557b6cb83.gz
parent 622a02f8
......@@ -63,4 +63,8 @@ ALIASES += \
"UserAgent=@ref sip_user_agent \"User-Agent\"" \
"Via=@ref sip_via \"Via\"" \
"WWWAuthenticate=@ref sip_www_authenticate \"WWW-Authenticate\"" \
"Warning=@ref sip_warning \"Warning\""
"Warning=@ref sip_warning \"Warning\"" \
"ReferSub=@ref sip_refer_sub \"Refer-Sub\"" \
"SuppressBodyIfMatch=@ref sip_suppress_body_if_match \"Suppress-Body-If-Match\"" \
"SuppressNotifyIfMatch=@ref sip_suppress_notify_if_match \"Suppress-Notify-If-Match\"" \
......@@ -41,6 +41,7 @@
#define MSG_HDR_T union sip_header_u
#include "sofia-sip/sip_parser.h"
#include "sofia-sip/sip_extra.h"
#include <stddef.h>
#include <stdlib.h>
......@@ -753,3 +754,137 @@ char *sip_info_dup_one(sip_header_t *dst,
return b;
}
/* ====================================================================== */
/**@SIP_HEADER sip_suppress_body_if_match Suppress-Body-If-Match Header
*
* The @b Suppress-Body-If-Match header field identifies a SIP event content
* already known by the watcher. Its syntax is defined in
* draft-niemi-sip-subnot-etags-01 as follows:
*
* @code
* Suppress-Body-If-Match = "Suppress-Body-If-Match" HCOLON entity-tag
* entity-tag = token
* @endcode
*
* The parsed Suppress-Body-If-Match header is stored in
* #sip_suppress_body_if_match_t structure.
*
* @sa @RFC3265, draft-niemi-sip-subnot-etags-01.txt
*
* @NEW_1_12_5. Note that #sip_t does not contain @a
* sip_suppress_body_if_match field, but sip_suppress_body_if_match()
* function should be used for accessing the @b Suppress-Body-If-Match
* header structure.
*/
/**@ingroup sip_suppress_body_if_match
* @typedef struct sip_suppress_body_if_match_s sip_suppress_body_if_match_t;
*
* The structure #sip_suppress_body_if_match_t contains representation of a
* SIP @SuppressBodyIfMatch header.
*
* The #sip_suppress_body_if_match_t is defined as follows:
* @code
* typedef struct sip_suppress_body_if_match_s
* {
* sip_common_t sbim_common[1]; // Common fragment info
* sip_error_t *sbim_next; // Dummy link to next header
* char const *sbim_tag; // entity-tag
* } sip_suppress_body_if_match_t;
* @endcode
*/
#define sip_suppress_body_if_match_dup_xtra msg_generic_dup_xtra
#define sip_suppress_body_if_match_dup_one msg_generic_dup_one
#define sip_suppress_body_if_match_update NULL
msg_hclass_t sip_suppress_body_if_match_class[] =
SIP_HEADER_CLASS(suppress_body_if_match,
"Suppress-Body-If-Match", "",
sbim_common, single, suppress_body_if_match);
issize_t sip_suppress_body_if_match_d(su_home_t *home,
sip_header_t *h,
char *s, isize_t slen)
{
sip_suppress_body_if_match_t *sbim = (void *)h;
return msg_token_d(&s, &sbim->sbim_tag);
}
issize_t sip_suppress_body_if_match_e(char b[], isize_t bsiz,
sip_header_t const *h,
int f)
{
return sip_etag_e(b, bsiz, h, f);
}
/* ====================================================================== */
/**@SIP_HEADER sip_suppress_notify_if_match Suppress-Notify-If-Match Header
*
* The @b Suppress-Notify-If-Match header is used to suppress
* superfluous NOTIFY transactions. Its syntax is defined in
* draft-niemi-sip-subnot-etags-01 as follows:
*
* @code
* Suppress-Notify-If-Match = "Suppress-Notify-If-Match" HCOLON entity-tag
* entity-tag = token
* @endcode
*
* The parsed Suppress-Notify-If-Match header is stored in
* #sip_suppress_notify_if_match_t structure.
*
* @sa @RFC3265, draft-niemi-sip-subnot-etag-01
*
* @NEW_1_12_5. Note that #sip_t does not contain @a
* sip_suppress_notify_if_match field, but sip_suppress_notify_if_match()
* function should be used for accessing the @b Suppress-Notify-If-Match
* header structure.
*/
/**@ingroup sip_suppress_notify_if_match
* @typedef struct sip_suppress_notify_if_match_s \
* sip_suppress_notify_if_match_t;
*
* The structure #sip_suppress_notify_if_match_t contains representation of a
* SIP @SuppressNotifyIfMatch header.
*
* The #sip_suppress_notify_if_match_t is defined as follows:
* @code
* typedef struct sip_suppress_notify_if_match_s
* {
* sip_common_t snim_common[1]; // Common fragment info
* sip_error_t *snim_next; // Dummy link to next header
* char const *snim_tag; // entity-tag
* } sip_suppress_notify_if_match_t;
* @endcode
*/
#define sip_suppress_notify_if_match_dup_xtra msg_generic_dup_xtra
#define sip_suppress_notify_if_match_dup_one msg_generic_dup_one
#define sip_suppress_notify_if_match_update NULL
msg_hclass_t sip_suppress_notify_if_match_class[] =
SIP_HEADER_CLASS(suppress_notify_if_match,
"Suppress-Notify-If-Match", "",
snim_common, single, suppress_notify_if_match);
issize_t sip_suppress_notify_if_match_d(su_home_t *home,
sip_header_t *h,
char *s, isize_t slen)
{
sip_suppress_notify_if_match_t *snim = (void *)h;
return msg_token_d(&s, &snim->snim_tag);
}
issize_t sip_suppress_notify_if_match_e(char b[], isize_t bsiz,
sip_header_t const *h,
int f)
{
return msg_generic_e(b, bsiz, h, f);
}
......@@ -7,5 +7,7 @@
#### EXTRA HEADER LIST STARTS HERE ####
refer_sub @VERSION_1_12_5 /**< Refer-Sub header */
suppress_body_if_match @VERSION_1_12_5 /**< Suppress-Body-If-Match header */
suppress_notify_if_match @VERSION_1_12_5 /**< Suppress-Notify-If-Match header*/
#### EXTRA HEADER LIST ENDS HERE ####
......@@ -454,8 +454,9 @@ static int sip_replaces_update(msg_common_t *h,
*
* The parsed Refer-Sub header is stored in #sip_refer_sub_t structure.
*
* @since New in @VERSION_1_12_4. Note that #sip_t does not contain @c
* sip_refer_sub field, but use sip_refer_sub() accessor function.
* @NEW_1_12_5. Note that #sip_t does not contain @a sip_refer_sub field,
* but sip_refer_sub() accessor function should be used for accessing @b
* Refer-Sub header structure.
*
* @sa @RFC4488, nua_refer(), #nua_i_refer
*/
......@@ -478,7 +479,7 @@ static int sip_replaces_update(msg_common_t *h,
* } sip_refer_sub_t;
* @endcode
*
* @since New in @VERSION_1_12_4.
* @NEW_1_12_5.
*/
static msg_xtra_f sip_refer_sub_dup_xtra;
......
/**@file sofia-sip/sip_extra.h.in
*
* -*- C -*-
* Template for <sofia-sip/sip_extra.h>.
*
* @date Created: Thu Oct 5 19:10:58 EEST 2006
*/
/* -*- C -*-
/* -*- C -*-
*
* This file is part of the Sofia-SIP package
*
......@@ -30,13 +30,13 @@
*
*/
#ifndef SIP_EXTRAS_H
/** Defined when <sofia-sip/sip_extras.h> has been included. */
#define SIP_EXTRAS_H
#ifndef SIP_EXTRA_H
/** Defined when <sofia-sip/sip_extra.h> has been included. */
#define SIP_EXTRA_H
/**@file sofia-sip/sip_extras.h
/**@file sofia-sip/sip_extra.h
*
* @brief Extra headers for SIP.
* @brief Extension headers for SIP.
*
* #AUTO#
*
......@@ -60,16 +60,39 @@ typedef struct sip_refer_sub_s sip_refer_sub_t;
*/
struct sip_refer_sub_s
{
sip_common_t rs_common[1]; /**< Common fragment info */
sip_error_t *rs_next; /**< Dummy link to next */
char const *rs_value; /**< "true" or "false" */
msg_param_t const *rs_params; /**< List of extension parameters */
sip_common_t rs_common[1]; /**< Common fragment info */
sip_error_t *rs_next; /**< Dummy link to next */
char const *rs_value; /**< "true" or "false" */
msg_param_t const *rs_params; /**< List of extension parameters */
};
typedef struct sip_suppress_body_if_match_s sip_suppress_body_if_match_t;
/**@ingroup sip_suppress_body_if_match
* @brief Structure for @SuppressBodyIfMatch header.
*/
struct sip_suppress_body_if_match_s
{
sip_common_t sbim_common[1]; /**< Common fragment info */
sip_error_t *sbim_next; /**< Dummy link to next header */
char const *sbim_tag; /**< Entity-tag */
};
typedef struct sip_suppress_notify_if_match_s sip_suppress_notify_if_match_t;
/**@ingroup sip_suppress_notify_if_match
* @brief Structure for @SuppressNotifyIfMatch header.
*/
struct sip_suppress_notify_if_match_s
{
sip_common_t snim_common[1]; /**< Common fragment info */
sip_error_t *snim_next; /**< Dummy link to next header */
char const *snim_tag; /**< Entity-tag */
};
/* Foo */
SOFIA_END_DECLS
#endif /** !defined(SIP_EXTRAS_H) */
#endif /** !defined(SIP_EXTRA_H) */
......@@ -829,6 +829,9 @@ static int test_encoding(void)
"Min-SE: 123\r\n"
"Session-Expires: 1200\r\n"
"Content-Type: text/plain\r\n"
"Refer-Sub: true\r\n"
"Suppress-Body-If-Match: humppa\r\n"
"Suppress-Notify-If-Match: zumppa\r\n"
"\r\n"
"Heippa!");
sip = sip_object(msg);
......@@ -1626,6 +1629,9 @@ static int sip_header_test(void)
"Max-Forwards: 12\r\n"
"Min-Expires: 150\r\n"
"Timestamp: 10.010 0.000100\r\n"
"Suppress-Body-If-Match: humppa \t\r\n"
"Suppress-Notify-If-Match: zumppa\r\n"
" \r\n"
"Content-Type: application/sdp\r\n"
"\r\n"
"v=0\r\n"
......@@ -1661,6 +1667,23 @@ static int sip_header_test(void)
TEST(sip->sip_max_forwards->mf_count, 12);
TEST(sip->sip_min_expires->me_delta, 150);
{
sip_suppress_body_if_match_t *sbim;
sip_suppress_notify_if_match_t *snim;
TEST_1(sbim = sip_suppress_body_if_match(sip));
TEST_S(sbim->sbim_tag, "humppa");
TEST_SIZE(offsetof(msg_generic_t, g_value),
offsetof(sip_suppress_body_if_match_t, sbim_tag));
TEST_1(snim = sip_suppress_notify_if_match(sip));
TEST_S(snim->snim_tag, "zumppa");
TEST_SIZE(offsetof(msg_generic_t, g_value),
offsetof(sip_suppress_notify_if_match_t, snim_tag));
}
TEST_1(sip->sip_from->a_display);
TEST_S(sip->sip_from->a_display, "h");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment