nth 1.12.11devel
Loading...
Searching...
No Matches
nth.h
Go to the documentation of this file.
1/*
2 * This file is part of the Sofia-SIP package
3 *
4 * Copyright (C) 2005 Nokia Corporation.
5 *
6 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
33/* ----------------------------------------------------------------------
34 * 1) Types
35 */
36
37#ifndef NTH_H_TYPES
38#define NTH_H_TYPES
39
41typedef struct nth_engine_s nth_engine_t;
43typedef struct nth_client_s nth_client_t;
44
46typedef struct nth_site_s nth_site_t;
48typedef struct nth_request_s nth_request_t;
49
50#ifndef NTH_CLIENT_MAGIC_T
54#define NTH_CLIENT_MAGIC_T struct nth_client_magic_s
55#endif
56
59
60#ifndef NTH_SITE_MAGIC_T
64#define NTH_SITE_MAGIC_T struct nth_site_magic_s
65#endif
66
69
70#endif
71
72#ifndef NTH_H
74#define NTH_H
75
76/* ----------------------------------------------------------------------
77 * 2) Constants
78 */
79
81#define NTH_VERSION "1.0"
82
83#define NTH_CLIENT_VERSION NTH_VERSION
84#define NTH_SERVER_VERSION NTH_VERSION
85
86/* ----------------------------------------------------------------------
87 * 3) Other include files
88 */
89
90#include <sofia-sip/su_wait.h>
91#include <sofia-sip/su_tag.h>
92#include <sofia-sip/http.h>
94
95#ifndef NTH_TAG_H
96#include <sofia-sip/nth_tag.h>
97#endif
98
99/* ----------------------------------------------------------------------
100 * 3) Engine prototypes
101 */
102
103SOFIA_BEGIN_DECLS
104
105NTH_DLL char const *nth_engine_version(void);
106
107NTH_DLL nth_engine_t *nth_engine_create(su_root_t *root,
108 tag_type_t tag, tag_value_t value, ...);
109NTH_DLL void nth_engine_destroy(nth_engine_t *engine);
110
111NTH_DLL int nth_engine_set_params(nth_engine_t *engine,
112 tag_type_t tag, tag_value_t value, ...);
113NTH_DLL int nth_engine_get_params(nth_engine_t const *engine,
114 tag_type_t tag, tag_value_t value, ...);
115NTH_DLL int nth_engine_get_stats(nth_engine_t const *engine,
116 tag_type_t tag, tag_value_t value, ...);
117
118NTH_DLL msg_t *nth_engine_msg_create(nth_engine_t *he, int flags);
119
120/* ----------------------------------------------------------------------
121 * 4) Prototypes for client transactions
122 */
123typedef int nth_response_f(nth_client_magic_t *magic,
124 nth_client_t *request,
125 http_t const *http);
126
127NTH_DLL nth_client_t *nth_client_tcreate(nth_engine_t *engine,
128 nth_response_f *callback,
129 nth_client_magic_t *magic,
130 http_method_t method,
131 char const *method_name,
132 url_string_t const *request_uri,
133 tag_type_t tag, tag_value_t value,
134 ...);
135
136NTH_DLL int nth_client_status(nth_client_t const *clnt);
137NTH_DLL http_method_t nth_client_method(nth_client_t const *cnlt);
138NTH_DLL int nth_client_is_streaming(nth_client_t const *hc);
139
140NTH_DLL url_t const *nth_client_url(nth_client_t const *clnt);
141
143NTH_DLL msg_t *nth_client_response(nth_client_t const *clnt);
144NTH_DLL void nth_client_destroy(nth_client_t *clnt);
145
146/* ----------------------------------------------------------------------
147 * 5) Server side prototypes
148 */
149
150typedef int nth_request_f(nth_site_magic_t *lmagic,
151 nth_site_t *server,
152 nth_request_t *req,
153 http_t const *http,
154 char const *path);
155
156char const *nth_site_server_version(void);
157
158NTH_DLL nth_site_t *nth_site_create(nth_site_t *parent,
159 nth_request_f *req_callback,
160 nth_site_magic_t *magic,
161 url_string_t const *address,
162 tag_type_t tag, tag_value_t value,
163 ...);
164
165NTH_DLL void nth_site_destroy(nth_site_t *site);
166
167NTH_DLL nth_site_magic_t *nth_site_magic(nth_site_t const *site);
168
169NTH_DLL void nth_site_bind(nth_site_t *site,
170 nth_request_f *callback,
172
173NTH_DLL su_time_t nth_site_access_time(nth_site_t const *site);
174
175NTH_DLL int nth_site_set_params(nth_site_t *site,
176 tag_type_t tag, tag_value_t value, ...);
177NTH_DLL int nth_site_get_params(nth_site_t const *site,
178 tag_type_t tag, tag_value_t value, ...);
179NTH_DLL int nth_site_get_stats(nth_site_t const *site,
180 tag_type_t tag, tag_value_t value, ...);
181
182NTH_DLL url_t const *nth_site_url(nth_site_t const *site);
183
184/* ----------------------------------------------------------------------
185 * 6) Prototypes for server transactions
186 */
187
188NTH_DLL int nth_request_status(nth_request_t const *req);
189NTH_DLL http_method_t nth_request_method(nth_request_t const *req);
190NTH_DLL msg_t *nth_request_message(nth_request_t *req);
191
192NTH_DLL int nth_request_treply(nth_request_t *ireq,
193 int status, char const *phrase,
194 tag_type_t tag, tag_value_t value, ...);
195
196NTH_DLL void nth_request_destroy(nth_request_t *req);
197
198NTH_DLL struct auth_status_t *nth_request_auth(nth_request_t const *req);
199
200SOFIA_END_DECLS
201
202#endif
http_method_t
NTH_CLIENT_MAGIC_T nth_client_magic_t
Application context for client requests.
Definition nth.h:58
#define NTH_SITE_MAGIC_T
Default type of application context for NTH servers.
Definition nth.h:64
msg_t * nth_engine_msg_create(nth_engine_t *he, int flags)
Create a new message.
Definition nth_client.c:553
char const * nth_site_server_version(void)
Return server name and version.
Definition nth_server.c:478
int nth_client_is_streaming(nth_client_t const *hc)
Is client streaming response?
Definition nth_client.c:1030
struct nth_client_s nth_client_t
NTH client request.
Definition nth.h:43
struct nth_engine_s nth_engine_t
NTH engine.
Definition nth.h:41
struct auth_status_t * nth_request_auth(nth_request_t const *req)
Return request authentication status.
Definition nth_server.c:1219
struct nth_request_s nth_request_t
Server transaction
Definition nth.h:48
msg_t * nth_client_request(nth_client_t *clnt)
Get request message.
Definition nth_client.c:1010
int nth_client_status(nth_client_t const *clnt)
Gets client status.
Definition nth_client.c:984
#define NTH_CLIENT_MAGIC_T
Default type of application context for client NTH requests.
Definition nth.h:54
url_t const * nth_client_url(nth_client_t const *clnt)
Get original Request-URI.
Definition nth_client.c:1004
msg_t * nth_client_response(nth_client_t const *clnt)
Get response message.
Definition nth_client.c:1021
http_method_t nth_client_method(nth_client_t const *cnlt)
Gets client method.
Definition nth_client.c:998
struct nth_site_s nth_site_t
NTH (virtual) hosts or site(s)
Definition nth.h:46
void nth_client_destroy(nth_client_t *clnt)
Destroy client request.
Definition nth_client.c:949
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.
Definition nth_server.c:262
url_t const * nth_site_url(nth_site_t const *site)
Get the site URL.
Definition nth_server.c:472
su_time_t nth_site_access_time(nth_site_t const *site)
Get the time last time served.
Definition nth_server.c:484
int nth_request_status(nth_request_t const *req)
Return request authentication status.
Definition nth_server.c:1201
NTH_SITE_MAGIC_T nth_site_magic_t
Application context for NTH servers.
Definition nth.h:68
Tags for nth, HTTP engine module.
intptr_t tag_value_t
struct tag_type_s const * tag_type_t
struct su_root_t su_root_t

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