"Fossies" - the Fresh Open Source Software Archive

Member "sitecopy-0.16.6/lib/neon/ne_private.h" (8 Feb 2008, 3755 Bytes) of archive /linux/www/sitecopy-0.16.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ne_private.h" see the Fossies "Dox" file reference documentation.

    1 /* 
    2    HTTP Request Handling
    3    Copyright (C) 1999-2008, Joe Orton <joe@manyfish.co.uk>
    4 
    5    This library is free software; you can redistribute it and/or
    6    modify it under the terms of the GNU Library General Public
    7    License as published by the Free Software Foundation; either
    8    version 2 of the License, or (at your option) any later version.
    9    
   10    This library is distributed in the hope that it will be useful,
   11    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13    Library General Public License for more details.
   14 
   15    You should have received a copy of the GNU Library General Public
   16    License along with this library; if not, write to the Free
   17    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
   18    MA 02111-1307, USA
   19 
   20 */
   21 
   22 /* THIS IS NOT A PUBLIC INTERFACE. You CANNOT include this header file
   23  * from an application.  */
   24  
   25 #ifndef NE_PRIVATE_H
   26 #define NE_PRIVATE_H
   27 
   28 #include "ne_request.h"
   29 #include "ne_socket.h"
   30 #include "ne_ssl.h"
   31 
   32 struct host_info {
   33     char *hostname;
   34     unsigned int port;
   35     ne_sock_addr *address; /* if non-NULL, result of resolving 'hostname'. */
   36     /* current network address obtained from 'address' being used. */
   37     const ne_inet_addr *current;
   38     char *hostport; /* URI hostport segment */
   39 };
   40 
   41 /* Store every registered callback in a generic container, and cast
   42  * the function pointer when calling it.  */
   43 struct hook {
   44     void (*fn)(void);
   45     void *userdata;
   46     const char *id; /* non-NULL for accessors. */
   47     struct hook *next;
   48 };
   49 
   50 #define HAVE_HOOK(st,func) (st->hook->hooks->func != NULL)
   51 #define HOOK_FUNC(st, func) (*st->hook->hooks->func)
   52 
   53 /* Session support. */
   54 struct ne_session_s {
   55     /* Connection information */
   56     ne_socket *socket;
   57 
   58     /* non-zero if connection has been established. */
   59     int connected;
   60     
   61     /* non-zero if connection has persisted beyond one request. */
   62     int persisted;
   63 
   64     int is_http11; /* >0 if connected server is known to be
   65             * HTTP/1.1 compliant. */
   66 
   67     char *scheme;
   68     struct host_info server, proxy;
   69 
   70     /* application-provided address list */
   71     const ne_inet_addr **addrlist;
   72     size_t numaddrs, curaddr;
   73 
   74     /* Local address to which sockets should be bound. */
   75     const ne_inet_addr *local_addr;
   76 
   77     /* Settings */
   78     int use_proxy; /* do we have a proxy server? */
   79     int use_ssl; /* whether a secure connection is required */
   80     int in_connect; /* doing a proxy CONNECT */
   81 
   82     int flags[NE_SESSFLAG_LAST];
   83 
   84     ne_progress progress_cb;
   85     void *progress_ud;
   86 
   87     ne_notify_status notify_cb;
   88     void *notify_ud;
   89 
   90     int rdtimeout, cotimeout; /* read, connect timeouts. */
   91 
   92     struct hook *create_req_hooks, *pre_send_hooks, *post_send_hooks,
   93         *post_headers_hooks, *destroy_req_hooks, *destroy_sess_hooks, 
   94         *close_conn_hooks, *private;
   95 
   96     char *user_agent; /* full User-Agent: header field */
   97 
   98 #ifdef NE_HAVE_SSL
   99     ne_ssl_client_cert *client_cert;
  100     ne_ssl_certificate *server_cert;
  101     ne_ssl_context *ssl_context;
  102 #endif
  103 
  104     /* Server cert verification callback: */
  105     ne_ssl_verify_fn ssl_verify_fn;
  106     void *ssl_verify_ud;
  107     /* Client cert provider callback: */
  108     ne_ssl_provide_fn ssl_provide_fn;
  109     void *ssl_provide_ud;
  110 
  111     ne_session_status_info status;
  112 
  113     /* Error string */
  114     char error[512];
  115 };
  116 
  117 /* Pushes block of 'count' bytes at 'buf'. Returns non-zero on
  118  * error. */
  119 typedef int (*ne_push_fn)(void *userdata, const char *buf, size_t count);
  120 
  121 /* Do the SSL negotiation. */
  122 int ne__negotiate_ssl(ne_session *sess);
  123 
  124 /* Set the session error appropriate for SSL verification failures. */
  125 void ne__ssl_set_verify_err(ne_session *sess, int failures);
  126 
  127 #endif /* HTTP_PRIVATE_H */