nta_check.c File Reference


Detailed Description

Checks for features, MIME types, session timer.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Wed Mar 8 16:35:05 EET 2006 ppessi

#include "config.h"
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/sip_header.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_util.h>
#include <sofia-sip/nta.h>

Include dependency graph for nta_check.c:


Functions

int nta_check_required (nta_incoming_t *irq, sip_t const *sip, sip_supported_t const *supported, tag_type_t tag, tag_value_t value,...)
 Check that we support all features which UAC requires.
int nta_check_supported (nta_incoming_t *irq, sip_t const *sip, sip_require_t *require, tag_type_t tag, tag_value_t value,...)
 Check that UAC supports all the required features.
int nta_check_method (nta_incoming_t *irq, sip_t const *sip, sip_allow_t const *allow, tag_type_t tag, tag_value_t value,...)
 Check that we allow the request method.
int nta_check_session_content (nta_incoming_t *irq, sip_t const *sip, sip_accept_t const *session_accepts, tag_type_t tag, tag_value_t value,...)
 Check that we understand session content in the request.
int nta_check_accept (nta_incoming_t *irq, sip_t const *sip, sip_accept_t const *acceptable, sip_accept_t const **return_acceptable, tag_type_t tag, tag_value_t value,...)
 Check that UAC accepts one of listed MIME content-types.
int nta_check_session_expires (nta_incoming_t *irq, sip_t const *sip, sip_time_t my_min_se, tag_type_t tag, tag_value_t value,...)
 Check Session-Expires header.

Function Documentation

int nta_check_accept ( nta_incoming_t irq,
sip_t const *  sip,
sip_accept_t const *  acceptable,
sip_accept_t const **  return_acceptable,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check that UAC accepts one of listed MIME content-types.

The list of acceptable content-types are compared with the acceptable content-types. If match is found, it is returned in return_acceptable. If no match is found, a 406 is returned. If irq is non-NULL, the 406 response message is sent to the client, too.

Parameters:
irq incoming transaction object (may be NULL).
sip contents of the SIP message
acceptable list of acceptable content types
return_acceptable optional return-value parameter for matched content-type
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
406 if no content-type is acceptable by client, 0 if successful.

int nta_check_method ( nta_incoming_t irq,
sip_t const *  sip,
sip_allow_t const *  allow,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check that we allow the request method.

The request-method is compared with the list of supported methods in allow. If match is found, 0 is is returned. Otherwise, if the request-method is well-known, 405 is returned. If the request-method is unknown, 501 is returned. If irq is non-NULL, the 405 or 501 response message is sent to the client, too.

Parameters:
irq incoming transaction object (may be NULL).
sip contents of the SIP message
allow list of allowed methods
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
0 if successful, 405 is request-method is not allowed, 501 if request-method is unknown.

int nta_check_required ( nta_incoming_t irq,
sip_t const *  sip,
sip_supported_t const *  supported,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check that we support all features which UAC requires.

The list of supported features is compared with the list of features required by the UAC. If some features are not listed as supported, return 420. If irq is non-NULL, the 420 response message is sent to the client along with list of unsupported features in the Unsupported header, too.

Parameters:
irq incoming transaction object (may be NULL).
sip contents of the SIP message
supported list of protocol features supported
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
0 if successful. 420 if any of the required features is not supported.

int nta_check_session_content ( nta_incoming_t irq,
sip_t const *  sip,
sip_accept_t const *  session_accepts,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check that we understand session content in the request.

If there is no Content-Disposition header or the Content-Disposition header indicated "session", the message body and content-type is compared with the acceptable session content-types listed in session_accepts. (typically, "application/sdp"). If no match is found, a 415 is returned. If irq is non-NULL, the 415 response message is sent to the client, too.

If the Content-Disposition header indicates something else but "session", and it does not contain "handling=optional" parameter, a 415 response is returned, too.

Also, the Content-Encoding header is checked. If it is not empty (indicating no content-encoding), a 415 response is returned, too.

Parameters:
irq incoming (server) transaction object (may be NULL).
sip contents of the SIP message
session_accepts list of acceptable content-types for "session" content disposition
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
0 if successful, 415 if content-type is not acceptable.

int nta_check_session_expires ( nta_incoming_t irq,
sip_t const *  sip,
sip_time_t  my_min_se,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check Session-Expires header.

If the proposed session-expiration time is smaller than Min-SE or our minimal session expiration time, respond with 422 containing shortest acceptable session expiration time in Min-SE header.

Parameters:
irq incoming transaction object (may be NULL).
sip contents of the SIP message
my_min_se minimal session expiration time in seconds
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
422 if session expiration time is too small, 0 when successful.

int nta_check_supported ( nta_incoming_t irq,
sip_t const *  sip,
sip_require_t require,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Check that UAC supports all the required features.

The list of required features is compared with the features supported by the UAC. If some features are not supported, return 421. If irq is non-NULL, the 421 response message is sent to the client, too.

Parameters:
irq incoming transaction object (may be NULL).
sip contents of the SIP message
require list of required protocol features
tag,value,... optional list of tagged arguments used when responding to the transaction
Returns:
0 if successful. 421 if any of the required features is not supported.


Sofia-SIP 1.12.6 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.