00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033
00034
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
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
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
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
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
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
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