bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / native / common / jk_connect.h
1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17
18 /***************************************************************************
19  * Description: Socket connections header file                             *
20  * Author:      Gal Shachor <shachor@il.ibm.com>                           *
21  * Version:     $Revision: 995751 $                                               *
22  ***************************************************************************/
23
24 #ifndef JK_CONNECT_H
25 #define JK_CONNECT_H
26
27 #include "jk_logger.h"
28 #include "jk_global.h"
29
30 #if !defined(WIN32) && !(defined(NETWARE) && defined(__NOVELL_LIBC__))
31 #define closesocket         close
32 #endif
33
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif                          /* __cplusplus */
38
39 #define JK_SOCKET_EOF      (-2)
40
41 int jk_resolve(const char *host, int port, struct sockaddr_in *rc, void *pool, jk_logger_t *l);
42
43 jk_sock_t jk_open_socket(struct sockaddr_in *addr, int keepalive,
44                          int timeout, int connect_timeout,
45                          int sock_buf, jk_logger_t *l);
46
47 int jk_close_socket(jk_sock_t sd, jk_logger_t *l);
48
49 int jk_shutdown_socket(jk_sock_t sd, jk_logger_t *l);
50
51 int jk_tcp_socket_sendfull(jk_sock_t sd, const unsigned char *b, int len, jk_logger_t *l);
52
53 int jk_tcp_socket_recvfull(jk_sock_t sd, unsigned char *b, int len, jk_logger_t *l);
54
55 char *jk_dump_hinfo(struct sockaddr_in *saddr, char *buf);
56
57 char *jk_dump_sinfo(jk_sock_t sd, char *buf);
58
59 int jk_is_input_event(jk_sock_t sd, int timeout, jk_logger_t *l);
60
61 int jk_is_socket_connected(jk_sock_t sd, jk_logger_t *l);
62
63
64 /***
65  * i5/OS V5R4 need ASCII<->EBCDIC translation for inet_addr() call
66  */
67 #if !defined(AS400_UTF8)
68
69 #define jk_inet_addr inet_addr
70
71 #endif
72
73
74 #ifdef __cplusplus
75 }
76 #endif                          /* __cplusplus */
77
78 #endif                          /* JK_CONNECT_H */