nanohttp-client.h

Go to the documentation of this file.
00001 /******************************************************************
00002  *  $Id: nanohttp-client.h,v 1.39 2007/01/03 08:33:44 m0gg Exp $
00003  *
00004  * CSOAP Project:  A http client/server library in C
00005  * Copyright (C) 2003  Ferhat Ayaz
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the
00019  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA  02111-1307, USA.
00021  * 
00022  * Email: ferhatayaz@yahoo.com
00023  ******************************************************************/
00024 #ifndef __nanohttp_client_h
00025 #define __nanohttp_client_h
00026 
00027 /* XXX: Clean up nanohttp to make this unnecessary */
00028 #ifndef __NHTTP_INTERNAL
00029 #include <nanohttp/nanohttp-error.h>
00030 #include <nanohttp/nanohttp-common.h>
00031 #include <nanohttp/nanohttp-stream.h>
00032 #include <nanohttp/nanohttp-request.h>
00033 #include <nanohttp/nanohttp-response.h>
00034 #include <nanohttp/nanohttp-logging.h>
00035 #endif
00036 
00199 typedef struct httpc_conn
00200 {
00201   struct hsocket_t *sock;
00202   hpair_t *header;
00203   struct hurl_t *url;
00204   http_version_t version;
00205 
00206   int errcode;
00207   char errmsg[150];
00208   struct http_output_stream_t *out;
00209   int id;                       /* uniq id */
00210 } httpc_conn_t;
00211 
00212 #ifdef __cplusplus
00213 extern "C" {
00214 #endif
00215 
00229 extern herror_t httpc_init(int argc, char **argv);
00230 
00238 extern void httpc_destroy(void);
00239 
00250 extern httpc_conn_t *httpc_new(void);
00251 
00260 extern void httpc_free(httpc_conn_t * conn);
00261 
00270 extern void httpc_close_free(httpc_conn_t * conn);
00271 
00284 extern int httpc_set_header(httpc_conn_t * conn, const char *key, const char *value);
00285 
00298 extern int httpc_add_header(httpc_conn_t *conn, const char *key, const char *value);
00299 
00310 extern void httpc_add_headers(httpc_conn_t *conn, const hpair_t *values);
00311 
00324 extern int httpc_set_basic_authorization(httpc_conn_t *conn, const char *user, const char *password);
00325 
00338 extern int httpc_set_basic_proxy_authorization(httpc_conn_t *conn, const char *user, const char *password);
00339 
00349 extern herror_t httpc_get(httpc_conn_t * conn, hresponse_t ** out, const char *urlstr);
00350 
00361 extern herror_t httpc_post_begin(httpc_conn_t * conn, const char *url);
00362 
00374 extern herror_t httpc_post_end(httpc_conn_t * conn, hresponse_t ** out);
00375 
00391 extern herror_t httpc_mime_begin(httpc_conn_t * conn, const char *url,
00392                           const char *related_start,
00393                           const char *related_start_info,
00394                           const char *related_type);
00395 
00405 extern herror_t httpc_mime_next(httpc_conn_t * conn,
00406                          const char *content_id,
00407                          const char *content_type,
00408                          const char *transfer_encoding);
00409 
00419 extern herror_t httpc_mime_end(httpc_conn_t * conn, hresponse_t ** out);
00420 
00430 extern herror_t httpc_mime_send_file(httpc_conn_t * conn,
00431                               const char *content_id,
00432                               const char *content_type,
00433                               const char *transfer_encoding,
00434                               const char *filename);
00435 
00436 #ifdef __cplusplus
00437 }
00438 #endif
00439 
00440 #endif

Generated on Thu Jan 25 23:36:02 2007 for csoap by  doxygen 1.4.6