Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
http_test_common.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HTTP_TEST_COMMON_H
18 #define HTTP_TEST_COMMON_H
19 
20 #include "globus_xio.h"
21 #include "globus_xio_http.h"
22 
23 typedef void (*globus_xio_http_request_ready_callback_t)(
24  void * user_arg,
25  globus_result_t result,
26  const char * method,
27  const char * uri,
28  globus_xio_http_version_t http_version,
29  globus_hashtable_t headers);
30 
31 typedef struct
32 {
33  globus_mutex_t mutex;
34  globus_cond_t cond;
35 
36  int outstanding_operation;
37 
38  globus_xio_server_t server;
39  globus_xio_handle_t handle;
40 
41  char * contact;
42 
43  globus_bool_t shutdown;
44  globus_bool_t shutdown_done;
45 
46  globus_xio_http_version_t http_version;
47  char * transfer_encoding;
48  globus_size_t buffer_size_t;
49 
50  globus_xio_driver_t http_driver;
51  globus_xio_driver_t tcp_driver;
52 
53  globus_hashtable_t uri_handlers;
54 }
55 http_test_server_t;
56 
57 
59 http_test_server_init(
60  http_test_server_t * server,
61  globus_xio_driver_t tcp_driver,
62  globus_xio_driver_t http_driver,
63  globus_xio_stack_t stack);
64 
66 http_test_server_register_handler(
67  http_test_server_t * server,
68  const char * uri,
69  globus_xio_http_request_ready_callback_t
70  ready_callback,
71  void * arg);
72 
74 http_test_server_run(
75  http_test_server_t * server);
76 
78 http_test_server_shutdown(
79  http_test_server_t * server);
80 
81 void
82 http_test_server_destroy(
83  http_test_server_t * server);
84 
86 http_test_server_respond(
87  http_test_server_t * server,
88  int status_code,
89  char * reason_phrase,
90  globus_xio_http_header_t * header_array,
91  size_t header_array_len);
92 
94 http_test_server_close_handle(
95  http_test_server_t * test_server);
96 
98 http_test_client_request(
99  globus_xio_handle_t * new_handle,
100  globus_xio_driver_t tcp_driver,
101  globus_xio_driver_t http_driver,
102  globus_xio_stack_t stack,
103  const char * contact,
104  const char * uri,
105  const char * method,
106  globus_xio_http_version_t http_version,
107  globus_xio_http_header_t * header_array,
108  size_t header_array_length);
109 
110 int
111 http_test_initialize(
112  globus_xio_driver_t * tcp_driver,
113  globus_xio_driver_t * http_driver,
114  globus_xio_stack_t * stack);
115 
117 http_is_eof(
118  globus_result_t res);
119 
120 #endif /* HTTP_TEST_COMMON_H */
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Globus XIO HTTP Driver Header.
Mutex.
Definition: globus_thread.h:107
HTTP Header.
Definition: globus_xio_http.h:132
Condition variable.
Definition: globus_thread.h:124
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
uint32_t globus_result_t
Definition: globus_types.h:99
globus_xio_http_version_t
Definition: globus_xio_http.h:231