Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

sip_request_t* sip_request_create ( su_home_t home,
sip_method_t  method,
char const *  name,
url_string_t const *  uri,
char const *  version 

Create a request line object.

Create a request line object with method enum method, method name name, request URI uri, and protocol version version. The memory for the header object is allocated from the memory home home.

home memory home used to allocate sip_request_t object
method method enum
name method name (required if method is not well-known)
uri request URI
version version string (defaults to "SIP/2.0" if NULL)
The following code fragment creates an OPTIONS request object:
   sip_request_t *rq;
   rq = sip_request_create(home, SIP_METHOD_OPTIONS, requestURI, NULL);
If you provide an non-NULL version string, it is not copied. The version string MUST remain constant.

Definition at line 208 of file sip_basic.c.

References MSG_STRING_DUP, sip_request_s::rq_method, sip_request_s::rq_method_name, sip_request_s::rq_url, sip_request_s::rq_version, sip_request_class, URL_DUP, url_xtra(), and url_string_t::us_url.

Referenced by nta_msg_ackbye(), and sip_route_follow().

  size_t xtra; 
  sip_request_t *rq;

  if (method)
    name = sip_method_name(method, name);

  if (!name)
    return NULL;

  if (!method)
    method = sip_method_code(name);

  xtra = url_xtra(uri->us_url) + (method ? 0 : strlen(name) + 1);

  rq = sip_header_alloc(home, sip_request_class, xtra)->sh_request;

  if (rq) {
    char *b = (char *)(rq + 1), *end = b + xtra;

    rq->rq_method      = method;
    rq->rq_method_name = name;
    if (!method) 
      MSG_STRING_DUP(b, rq->rq_method_name, name);

    URL_DUP(b, end, rq->rq_url, uri->us_url);

    rq->rq_version = version ? version : SIP_VERSION_CURRENT;
    assert(b == end);

  return rq;

Generated by  Doxygen 1.6.0   Back to index