sofia-sip/nth.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00033 /* ----------------------------------------------------------------------
00034  * 1) Types 
00035  */
00036 
00037 #ifndef NTH_H_TYPES 
00038 #define NTH_H_TYPES
00039 
00041 typedef struct nth_engine_s   nth_engine_t;
00043 typedef struct nth_client_s   nth_client_t;
00044 
00046 typedef struct nth_site_s   nth_site_t;
00048 typedef struct nth_request_s nth_request_t;
00049 
00050 #ifndef NTH_CLIENT_MAGIC_T
00051 
00054 #define NTH_CLIENT_MAGIC_T struct nth_client_magic_s
00055 #endif
00056 
00058 typedef NTH_CLIENT_MAGIC_T  nth_client_magic_t;
00059 
00060 #ifndef NTH_SITE_MAGIC_T
00061 
00064 #define NTH_SITE_MAGIC_T struct nth_site_magic_s
00065 #endif
00066 
00068 typedef NTH_SITE_MAGIC_T   nth_site_magic_t;
00069 
00070 #endif
00071 
00072 #ifndef NTH_H
00073 
00074 #define NTH_H
00075 
00076 /* ----------------------------------------------------------------------
00077  * 2) Constants 
00078  */
00079 
00081 #define NTH_VERSION "1.0"
00082 
00083 #define NTH_CLIENT_VERSION NTH_VERSION
00084 #define NTH_SERVER_VERSION NTH_VERSION
00085 
00086 /* ----------------------------------------------------------------------
00087  * 3) Other include files
00088  */
00089 
00090 #include <sofia-sip/su_wait.h>
00091 #include <sofia-sip/su_tag.h>
00092 #include <sofia-sip/http.h>
00093 #include <sofia-sip/http_status.h>
00094 
00095 #ifndef NTH_TAG_H
00096 #include <sofia-sip/nth_tag.h>
00097 #endif
00098 
00099 /* ----------------------------------------------------------------------
00100  * 3) Engine prototypes
00101  */
00102 
00103 SOFIA_BEGIN_DECLS
00104 
00105 NTH_DLL char const *nth_engine_version(void);
00106 
00107 NTH_DLL nth_engine_t *nth_engine_create(su_root_t *root,
00108                                         tag_type_t tag, tag_value_t value, ...);
00109 NTH_DLL void nth_engine_destroy(nth_engine_t *engine);
00110 
00111 NTH_DLL int nth_engine_set_params(nth_engine_t *engine, 
00112                                   tag_type_t tag, tag_value_t value, ...);
00113 NTH_DLL int nth_engine_get_params(nth_engine_t const *engine, 
00114                                   tag_type_t tag, tag_value_t value, ...);
00115 NTH_DLL int nth_engine_get_stats(nth_engine_t const *engine, 
00116                                  tag_type_t tag, tag_value_t value, ...);
00117 
00118 NTH_DLL msg_t *nth_engine_msg_create(nth_engine_t *he, int flags);
00119 
00120 /* ----------------------------------------------------------------------
00121  * 4) Prototypes for client transactions
00122  */
00123 typedef int nth_response_f(nth_client_magic_t *magic,
00124                            nth_client_t *request,
00125                            http_t const *http);
00126 
00127 NTH_DLL nth_client_t *nth_client_tcreate(nth_engine_t *engine,
00128                                          nth_response_f *callback,
00129                                          nth_client_magic_t *magic,
00130                                          http_method_t method,
00131                                          char const *method_name,
00132                                          url_string_t const *request_uri,
00133                                          tag_type_t tag, tag_value_t value,
00134                                          ...);
00135 
00136 NTH_DLL int nth_client_status(nth_client_t const *clnt);
00137 NTH_DLL http_method_t nth_client_method(nth_client_t const *cnlt);
00138 NTH_DLL int nth_client_is_streaming(nth_client_t const *hc);
00139 
00140 NTH_DLL url_t const *nth_client_url(nth_client_t const *clnt);
00141 
00142 NTH_DLL msg_t *nth_client_request(nth_client_t *clnt);
00143 NTH_DLL msg_t *nth_client_response(nth_client_t const *clnt);
00144 NTH_DLL void nth_client_destroy(nth_client_t *clnt);
00145 
00146 /* ----------------------------------------------------------------------
00147  * 5) Server side prototypes
00148  */
00149 
00150 typedef int nth_request_f(nth_site_magic_t *lmagic, 
00151                           nth_site_t *server,
00152                           nth_request_t *req, 
00153                           http_t const *http,
00154                           char const *path);
00155 
00156 char const *nth_site_server_version(void);
00157 
00158 NTH_DLL nth_site_t *nth_site_create(nth_site_t *parent,  
00159                                     nth_request_f *req_callback,
00160                                     nth_site_magic_t *magic,
00161                                     url_string_t const *address,
00162                                     tag_type_t tag, tag_value_t value,
00163                                     ...);
00164 
00165 NTH_DLL void nth_site_destroy(nth_site_t *site);
00166 
00167 NTH_DLL nth_site_magic_t *nth_site_magic(nth_site_t const *site);
00168 
00169 NTH_DLL void nth_site_bind(nth_site_t *site, 
00170                            nth_request_f *callback, 
00171                            nth_site_magic_t *);
00172 
00173 NTH_DLL su_time_t nth_site_access_time(nth_site_t const *site);
00174 
00175 NTH_DLL int nth_site_set_params(nth_site_t *site, 
00176                                 tag_type_t tag, tag_value_t value, ...);
00177 NTH_DLL int nth_site_get_params(nth_site_t const *site,
00178                                 tag_type_t tag, tag_value_t value, ...);
00179 NTH_DLL int nth_site_get_stats(nth_site_t const *site,
00180                                tag_type_t tag, tag_value_t value, ...);
00181 
00182 NTH_DLL url_t const *nth_site_url(nth_site_t const *site);
00183 
00184 /* ----------------------------------------------------------------------
00185  * 6) Prototypes for server transactions 
00186  */
00187 
00188 NTH_DLL int nth_request_status(nth_request_t const *req);
00189 NTH_DLL http_method_t nth_request_method(nth_request_t const *req);
00190 NTH_DLL msg_t *nth_request_message(nth_request_t *req);
00191 
00192 NTH_DLL int nth_request_treply(nth_request_t *ireq, 
00193                                int status, char const *phrase, 
00194                                tag_type_t tag, tag_value_t value, ...);
00195 
00196 NTH_DLL void nth_request_destroy(nth_request_t *req);
00197 
00198 NTH_DLL struct auth_status_t *nth_request_auth(nth_request_t const *req);
00199 
00200 SOFIA_END_DECLS
00201 
00202 #endif

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