Loading...
Searching...
No Matches
nth.h File Reference

Transaction API for HTTP. More...

`#include <sofia-sip/su_wait.h>`
`#include <sofia-sip/su_tag.h>`
`#include <sofia-sip/http.h>`
`#include <sofia-sip/http_status.h>`
`#include <sofia-sip/nth_tag.h>`
Include dependency graph for nth.h:

Go to the source code of this file.

## Macros

#define | NTH_CLIENT_MAGIC_T
| Default type of application context for client NTH requests.
#define | NTH_SITE_MAGIC_T
| Default type of application context for NTH servers.
#define | NTH_H
| Defined when <sofia-sip/nth.h> has been included.
#define | NTH_VERSION
| Version number.

## Typedefs

typedef struct nth_engine_s | nth_engine_t
| NTH engine.
typedef struct nth_client_s | nth_client_t
| NTH client request.
typedef struct nth_site_s | nth_site_t
| NTH (virtual) hosts or site(s).
typedef struct nth_request_s | nth_request_t
| Server transaction.
typedef NTH_CLIENT_MAGIC_T | nth_client_magic_t
| Application context for client requests.
typedef NTH_SITE_MAGIC_T | nth_site_magic_t
| Application context for NTH servers.

## Functions

msg_t * | nth_engine_msg_create (nth_engine_t *he, int flags)
| Create a new message.
int | nth_client_status (nth_client_t const *clnt)
| Gets client status.
http_method_t | nth_client_method (nth_client_t const *cnlt)
| Gets client method.
int | nth_client_is_streaming (nth_client_t const *hc)
| Is client streaming response?
url_t const * | nth_client_url (nth_client_t const *clnt)
| Get original Request-URI.
msg_t * | nth_client_request (nth_client_t *clnt)
| Get request message.
msg_t * | nth_client_response (nth_client_t const *clnt)
| Get response message.
void | nth_client_destroy (nth_client_t *clnt)
| Destroy client request.
char const * | nth_site_server_version (void)
| Return server name and version.
nth_site_t * | nth_site_create (nth_site_t *parent, nth_request_f *req_callback, nth_site_magic_t *magic, url_string_t const *address, tag_type_t tag, tag_value_t value,...)
| Create a http site object.
su_time_t | nth_site_access_time (nth_site_t const *site)
| Get the time last time served.
url_t const * | nth_site_url (nth_site_t const *site)
| Get the site URL.
int | nth_request_status (nth_request_t const *req)
| Return request authentication status.
struct auth_status_t * | nth_request_auth (nth_request_t const *req)
| Return request authentication status.

## Detailed Description

Transaction API for HTTP.

Author
  Pekka Pessi Pekka.nosp@m..Pes.nosp@m.si@no.nosp@m.kia..nosp@m.com.

Date
  Created: Wed Jun 5 19:25:18 2002 ppessi

## Macro Definition Documentation

## NTH_CLIENT_MAGIC_T

#define NTH_CLIENT_MAGIC_T

Default type of application context for client NTH requests.

Application may define this to appropriate type before including <sofia-sip/nth.h>.

## NTH_SITE_MAGIC_T

#define NTH_SITE_MAGIC_T

Default type of application context for NTH servers.

Application may define this to appropriate type before including <sofia-sip/nth.h>.

## Function Documentation

## nth_client_method()

http_method_t nth_client_method | ( | nth_client_t const * | hc | ) |

Gets client method.

Parameters

  hc | pointer to a nth client object

Returns
  Returns the HTTP method from the request. If hc is NULL, returns http_method_invalid.

## nth_client_status()

int nth_client_status | ( | nth_client_t const * | hc | ) |

Gets client status.

Parameters

  hc | pointer to a nth client object

Returns
  Returns the status code from the response message if it has been received. A status code below 100 indicates that no response has been received. If request timeouts, the connection is closed and the status code is set to 408. If hc is NULL, returns 400 (Bad Request).

## nth_request_auth()

struct auth_status_t * nth_request_auth | ( | nth_request_t const * | req | ) |

Return request authentication status.

Parameters

  req | pointer to HTTP request object

Return values

  Pointer | to authentication status struct

Note
  The authentication status struct is freed when the nth_request_t object is destroyed.

Since
  New in 1.12.4

See also
  AUTH

## nth_request_status()

int nth_request_status | ( | nth_request_t const * | req | ) |

Return request authentication status.

Parameters

  req | pointer to HTTP request object

Return values

  Status | code

Since
  New in 1.12.4

## nth_site_access_time()

su_time_t nth_site_access_time | ( | nth_site_t const * | site | ) |

Get the time last time served.

Since
  New in 1.12.4.

## nth_site_create()

nth_site_t * nth_site_create | ( | nth_site_t * | parent,
|  | nth_request_f * | callback,
|  | nth_site_magic_t * | magic,
|  | url_string_t const * | address,
|  | tag_type_t | tag,
|  | tag_value_t | value,
|  |  | ... )

Create a http site object.

The function nth_site_create() allocates and initializes a web site object. A web site object can be either

- a primary http server (parent is NULL),
- a virtual http server (address contains hostpart), or
- a site within a server (address does not have hostpart, only path part).

Parameters

  parent | pointer to parent site (NULL when creating a primary server object)
  callback | pointer to callback function called when a request is received
  magic | application context included in callback parameters
  address | absolute or relative URI specifying the address of site
  tag,value,... | list of tagged parameters

Related Tags:
  If the parent is NULL, the list of tagged parameters must contain NTHTAG_ROOT() used to create the server engine. Tags supported when parent is NULL are NTHTAG_ROOT(), NTHTAG_MCLASS(), TPTAG_REUSE(), HTTPTAG_SERVER(), and HTTPTAG_SERVER_STR(). All the tags are passed to tport_tcreate() and tport_tbind(), too.

Since
  Support for multiple sites was added to 1.12.4

## nth_site_url()

url_t const * nth_site_url | ( | nth_site_t const * | site | ) |

Get the site URL.

Since
  New in 1.12.4.

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