CUBRID Engine  latest
jsp_comm.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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 
20 /*
21  * jsp_comm.h - Functions to communicate with Java Stored Procedure Server
22  *
23  * Note:
24  */
25 
26 #ifndef _JSP_COMM_H_
27 #define _JSP_COMM_H_
28 
29 #ident "$Id$"
30 
31 #if !defined(WINDOWS)
32 #include <sys/socket.h>
33 #else /* not WINDOWS */
34 #include <winsock2.h>
35 #endif /* not WINDOWS */
36 
37 #include <vector>
38 #include <string>
39 
40 #include "porting.h"
41 
42 typedef enum
43 {
46  SP_CODE_ERROR = 0x04,
49 
54 } SP_CODE;
55 
58 {
59  int pid;
60  int port;
61  char *db_name;
62  // *INDENT-OFF*
63  std::vector < std::string > vm_args;
64  // *INDENT-ON*
65 };
66 
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif
71 
73  void jsp_disconnect_server (const SOCKET sockfd);
74  int jsp_writen (SOCKET fd, const void *vptr, int n);
75  int jsp_readn (SOCKET fd, void *vptr, int n);
76 
77 #if defined(WINDOWS)
78  extern int windows_socket_startup (FARPROC hook);
79  extern void windows_socket_shutdown (FARPROC hook);
80 #endif /* WINDOWS */
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* _JSP_COMM_H_ */
int SOCKET
Definition: porting.h:482
void jsp_disconnect_server(const SOCKET sockfd)
Definition: jsp_comm.c:135
std::vector< std::string > vm_args
Definition: jsp_comm.h:63
int jsp_writen(SOCKET fd, const void *vptr, int n)
Definition: jsp_comm.c:160
static int server_port
Definition: jsp_cl.c:109
SP_CODE
Definition: jsp_comm.h:42
SOCKET jsp_connect_server(int server_port)
Definition: jsp_comm.c:58
int jsp_readn(SOCKET fd, void *vptr, int n)
Definition: jsp_comm.c:212