"Fossies" - the Fresh Open Source Software Archive 
Member "httperf-0.9.0/src/conn.h" (7 Apr 2007, 4122 Bytes) of package /linux/www/old/httperf-0.9.0.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 "conn.h" see the
Fossies "Dox" file reference documentation.
1 /*
2 httperf -- a tool for measuring web server performance
3 Copyright 2000-2007 Hewlett-Packard Company and Contributors listed in
4 AUTHORS file. Originally contributed by David Mosberger-Tang
5
6 This file is part of httperf, a web server performance measurment
7 tool.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version.
13
14 In addition, as a special exception, the copyright holders give
15 permission to link the code of this work with the OpenSSL project's
16 "OpenSSL" library (or with modified versions of it that use the same
17 license as the "OpenSSL" library), and distribute linked combinations
18 including the two. You must obey the GNU General Public License in
19 all respects for all of the code used other than "OpenSSL". If you
20 modify this file, you may extend this exception to your version of the
21 file, but you are not obligated to do so. If you do not wish to do
22 so, delete this exception statement from your version.
23
24 This program is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 General Public License for more details.
28
29 You should have received a copy of the GNU General Public License
30 along with this program; if not, write to the Free Software
31 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 02110-1301, USA
33 */
34 #ifndef conn_h
35 #define conn_h
36
37 #include "config.h"
38
39 #include <sys/uio.h>
40
41 #include <httperf.h>
42 #include <object.h>
43 #include <timer.h>
44
45 #ifdef HAVE_SSL
46 # include <openssl/ssl.h>
47 # include <openssl/err.h>
48 #endif
49
50 /* Maximum header line length that we can process properly. Longer
51 lines will be treated as if they were only this long (i.e., they
52 will be truncated). */
53 #define MAX_HDR_LINE_LEN 1024
54
55 struct Call;
56
57 typedef enum Conn_State
58 {
59 S_INITIAL,
60 S_CONNECTING,
61 S_CONNECTED,
62 S_REPLY_STATUS,
63 S_REPLY_HEADER,
64 S_REPLY_CONTINUE,
65 S_REPLY_DATA,
66 S_REPLY_CHUNKED,
67 S_REPLY_FOOTER,
68 S_REPLY_DONE,
69 S_CLOSING,
70 S_FREE
71 }
72 Conn_State;
73
74 typedef struct Conn
75 {
76 Object obj;
77
78 Conn_State state;
79 struct Conn *next;
80 struct Call *sendq; /* calls whose request needs to be sent */
81 struct Call *sendq_tail;
82 struct Call *recvq; /* calls waiting for a reply */
83 struct Call *recvq_tail;
84 Timer *watchdog;
85
86 struct
87 {
88 Time time_connect_start; /* time connect() got called */
89 u_int num_calls_completed; /* # of calls that completed */
90 }
91 basic; /* maintained by stat/stats_basic.c */
92
93 size_t hostname_len;
94 const char *hostname; /* server's hostname (or 0 for default) */
95 size_t fqdname_len;
96 const char *fqdname; /* fully qualified server name (or 0) */
97 int port; /* server's port (or -1 for default) */
98 int sd; /* socket descriptor */
99 int myport; /* local port number or -1 */
100 /* Since replies are read off the socket sequentially, much of the
101 reply-processing related state can be kept here instead of in
102 the reply structure: */
103 struct iovec line; /* buffer used to parse reply headers */
104 size_t content_length; /* content length (or INF if unknown) */
105 u_int has_body : 1; /* does reply have a body? */
106 u_int is_chunked : 1; /* is the reply chunked? */
107 char line_buf[MAX_HDR_LINE_LEN]; /* default line buffer */
108
109 #ifdef HAVE_SSL
110 SSL *ssl; /* SSL connection info */
111 #endif
112 }
113 Conn;
114
115 extern int max_num_conn;
116 extern Conn *conn;
117
118 /* Initialize the new connection object C. */
119 extern void conn_init (Conn *c);
120
121 /* Destroy the connection-specific state in connection object C. */
122 extern void conn_deinit (Conn *c);
123
124 #define conn_new() ((Conn *) object_new (OBJ_CONN))
125 #define conn_inc_ref(c) object_inc_ref ((Object *) (c))
126 #define conn_dec_ref(c) object_dec_ref ((Object *) (c))
127
128 #endif /* conn_h */