nth  1.12.11devel
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 
41 typedef struct nth_engine_s nth_engine_t;
43 typedef struct nth_client_s nth_client_t;
44 
46 typedef struct nth_site_s nth_site_t;
48 typedef struct nth_request_s nth_request_t;
49 
50 #ifndef NTH_CLIENT_MAGIC_T
51 
54 #define NTH_CLIENT_MAGIC_T struct nth_client_magic_s
55 #endif
56 
59 
60 #ifndef NTH_SITE_MAGIC_T
61 
64 #define NTH_SITE_MAGIC_T struct nth_site_magic_s
65 #endif
66 
69 
70 #endif
71 
72 #ifndef NTH_H
73 
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>
93 #include <sofia-sip/http_status.h>
94 
95 #ifndef NTH_TAG_H
96 #include <sofia-sip/nth_tag.h>
97 #endif
98 
99 /* ----------------------------------------------------------------------
100  * 3) Engine prototypes
101  */
102 
103 SOFIA_BEGIN_DECLS
104 
105 NTH_DLL char const *nth_engine_version(void);
106 
107 NTH_DLL nth_engine_t *nth_engine_create(su_root_t *root,
108  tag_type_t tag, tag_value_t value, ...);
109 NTH_DLL void nth_engine_destroy(nth_engine_t *engine);
110 
111 NTH_DLL int nth_engine_set_params(nth_engine_t *engine,
112  tag_type_t tag, tag_value_t value, ...);
113 NTH_DLL int nth_engine_get_params(nth_engine_t const *engine,
114  tag_type_t tag, tag_value_t value, ...);
115 NTH_DLL int nth_engine_get_stats(nth_engine_t const *engine,
116  tag_type_t tag, tag_value_t value, ...);
117 
118 NTH_DLL msg_t *nth_engine_msg_create(nth_engine_t *he, int flags);
119 
120 /* ----------------------------------------------------------------------
121  * 4) Prototypes for client transactions
122  */
123 typedef int nth_response_f(nth_client_magic_t *magic,
124  nth_client_t *request,
125  http_t const *http);
126 
127 NTH_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 
136 NTH_DLL int nth_client_status(nth_client_t const *clnt);
137 NTH_DLL http_method_t nth_client_method(nth_client_t const *cnlt);
138 NTH_DLL int nth_client_is_streaming(nth_client_t const *hc);
139 
140 NTH_DLL url_t const *nth_client_url(nth_client_t const *clnt);
141 
142 NTH_DLL msg_t *nth_client_request(nth_client_t *clnt);
143 NTH_DLL msg_t *nth_client_response(nth_client_t const *clnt);
144 NTH_DLL void nth_client_destroy(nth_client_t *clnt);
145 
146 /* ----------------------------------------------------------------------
147  * 5) Server side prototypes
148  */
149 
150 typedef 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 
156 char const *nth_site_server_version(void);
157 
158 NTH_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 
165 NTH_DLL void nth_site_destroy(nth_site_t *site);
166 
167 NTH_DLL nth_site_magic_t *nth_site_magic(nth_site_t const *site);
168 
169 NTH_DLL void nth_site_bind(nth_site_t *site,
170  nth_request_f *callback,
171  nth_site_magic_t *);
172 
173 NTH_DLL su_time_t nth_site_access_time(nth_site_t const *site);
174 
175 NTH_DLL int nth_site_set_params(nth_site_t *site,
176  tag_type_t tag, tag_value_t value, ...);
177 NTH_DLL int nth_site_get_params(nth_site_t const *site,
178  tag_type_t tag, tag_value_t value, ...);
179 NTH_DLL int nth_site_get_stats(nth_site_t const *site,
180  tag_type_t tag, tag_value_t value, ...);
181 
182 NTH_DLL url_t const *nth_site_url(nth_site_t const *site);
183 
184 /* ----------------------------------------------------------------------
185  * 6) Prototypes for server transactions
186  */
187 
188 NTH_DLL int nth_request_status(nth_request_t const *req);
189 NTH_DLL http_method_t nth_request_method(nth_request_t const *req);
190 NTH_DLL msg_t *nth_request_message(nth_request_t *req);
191 
192 NTH_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 
196 NTH_DLL void nth_request_destroy(nth_request_t *req);
197 
198 NTH_DLL struct auth_status_t *nth_request_auth(nth_request_t const *req);
199 
200 SOFIA_END_DECLS
201 
202 #endif
nth_request_auth
struct auth_status_t * nth_request_auth(nth_request_t const *req)
Return request authentication status.
Definition: nth_server.c:1219
nth_client_t
struct nth_client_s nth_client_t
NTH client request.
Definition: nth.h:43
nth_engine_t
struct nth_engine_s nth_engine_t
NTH engine.
Definition: nth.h:41
nth_client_method
http_method_t nth_client_method(nth_client_t const *cnlt)
Gets client method.
Definition: nth_client.c:998
nth_engine_msg_create
msg_t * nth_engine_msg_create(nth_engine_t *he, int flags)
Create a new message.
Definition: nth_client.c:553
tag_type_t
struct tag_type_s const * tag_type_t
su_time_s
su_tag.h
nth_client_status
int nth_client_status(nth_client_t const *clnt)
Gets client status.
Definition: nth_client.c:984
nth_site_magic_t
NTH_SITE_MAGIC_T nth_site_magic_t
Application context for NTH servers.
Definition: nth.h:68
url_t
nth_client_destroy
void nth_client_destroy(nth_client_t *clnt)
Destroy client request.
Definition: nth_client.c:949
tag_value_t
intptr_t tag_value_t
nth_request_t
struct nth_request_s nth_request_t
Server transaction
Definition: nth.h:48
nth_client_request
msg_t * nth_client_request(nth_client_t *clnt)
Get request message.
Definition: nth_client.c:1010
nth_site_access_time
su_time_t nth_site_access_time(nth_site_t const *site)
Get the time last time served.
Definition: nth_server.c:484
http_s
http_status.h
url_string_t
http.h
nth_site_server_version
char const * nth_site_server_version(void)
Return server name and version.
Definition: nth_server.c:478
nth_tag.h
Tags for nth, HTTP engine module.
nth_site_create
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
su_root_t
struct su_root_t su_root_t
su_wait.h
msg_s
nth_request_status
int nth_request_status(nth_request_t const *req)
Return request authentication status.
Definition: nth_server.c:1201
nth_client_magic_t
NTH_CLIENT_MAGIC_T nth_client_magic_t
Application context for client requests.
Definition: nth.h:58
nth_client_response
msg_t * nth_client_response(nth_client_t const *clnt)
Get response message.
Definition: nth_client.c:1021
NTH_CLIENT_MAGIC_T
#define NTH_CLIENT_MAGIC_T
Default type of application context for client NTH requests.
Definition: nth.h:54
nth_client_url
url_t const * nth_client_url(nth_client_t const *clnt)
Get original Request-URI.
Definition: nth_client.c:1004
NTH_SITE_MAGIC_T
#define NTH_SITE_MAGIC_T
Default type of application context for NTH servers.
Definition: nth.h:64
nth_site_url
url_t const * nth_site_url(nth_site_t const *site)
Get the site URL.
Definition: nth_server.c:472
nth_site_t
struct nth_site_s nth_site_t
NTH (virtual) hosts or site(s)
Definition: nth.h:46
http_method_t
http_method_t
nth_client_is_streaming
int nth_client_is_streaming(nth_client_t const *hc)
Is client streaming response?
Definition: nth_client.c:1030

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