• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2      This file is part of libmicrohttpd
3      Copyright (C) 2007 Daniel Pittman and Christian Grothoff
4 
5      This library is free software; you can redistribute it and/or
6      modify it under the terms of the GNU Lesser General Public
7      License as published by the Free Software Foundation; either
8      version 2.1 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      Lesser General Public License for more details.
14 
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19 
20 /**
21  * @file connection.h
22  * @brief  Methods for managing connections
23  * @author Daniel Pittman
24  * @author Christian Grothoff
25  */
26 
27 #ifndef CONNECTION_H
28 #define CONNECTION_H
29 
30 #include "internal.h"
31 
32 
33 /**
34  * Set callbacks for this connection to those for HTTP.
35  *
36  * @param connection connection to initialize
37  */
38 void
39 MHD_set_http_callbacks_ (struct MHD_Connection *connection);
40 
41 
42 /**
43  * This function handles a particular connection when it has been
44  * determined that there is data to be read off a socket. All
45  * implementations (multithreaded, external select, internal select)
46  * call this function to handle reads.
47  *
48  * @param connection connection to handle
49  * @return always MHD_YES (we should continue to process the
50  *         connection)
51  */
52 int
53 MHD_connection_handle_read (struct MHD_Connection *connection);
54 
55 
56 /**
57  * This function was created to handle writes to sockets when it has
58  * been determined that the socket can be written to. All
59  * implementations (multithreaded, external select, internal select)
60  * call this function
61  *
62  * @param connection connection to handle
63  * @return always MHD_YES (we should continue to process the
64  *         connection)
65  */
66 int
67 MHD_connection_handle_write (struct MHD_Connection *connection);
68 
69 
70 /**
71  * This function was created to handle per-connection processing that
72  * has to happen even if the socket cannot be read or written to.  All
73  * implementations (multithreaded, external select, internal select)
74  * call this function.
75  *
76  * @param connection connection to handle
77  * @return MHD_YES if we should continue to process the
78  *         connection (not dead yet), MHD_NO if it died
79  */
80 int
81 MHD_connection_handle_idle (struct MHD_Connection *connection);
82 
83 
84 /**
85  * Close the given connection and give the
86  * specified termination code to the user.
87  *
88  * @param connection connection to close
89  * @param termination_code termination reason to give
90  */
91 void
92 MHD_connection_close (struct MHD_Connection *connection,
93 		      enum MHD_RequestTerminationCode termination_code);
94 
95 
96 #if EPOLL_SUPPORT
97 /**
98  * Perform epoll processing, possibly moving the connection back into
99  * the epoll set if needed.
100  *
101  * @param connection connection to process
102  * @return MHD_YES if we should continue to process the
103  *         connection (not dead yet), MHD_NO if it died
104  */
105 int
106 MHD_connection_epoll_update_ (struct MHD_Connection *connection);
107 #endif
108 
109 
110 #endif
111