CUBRID Engine  latest
broker_wsa_init.c
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  * broker_wsa_init.c -
22  */
23 
24 #ident "$Id$"
25 
26 #include <winsock2.h>
27 #include <windows.h>
28 #include <winsock.h>
29 
30 int
32 {
33  WORD wVersionRequested;
34  WSADATA wsaData;
35  int err;
36 
37  wVersionRequested = MAKEWORD (1, 1);
38 
39  err = WSAStartup (wVersionRequested, &wsaData);
40 
41  if (err != 0)
42  return -1;
43 
44  /* Confirm that the Windows Sockets DLL supports 1.1. */
45  /* Note that if the DLL supports versions greater */
46  /* than 1.1 in addition to 1.1, it will still return */
47  /* 1.1 in wVersion since that is the version we */
48  /* requested. */
49  if (LOBYTE (wsaData.wVersion) != 1 || HIBYTE (wsaData.wVersion) != 1)
50  {
51  WSACleanup ();
52  return -1;
53  }
54  /* The Windows Sockets DLL is acceptable. Proceed. */
55 
56 
57  /* Make sure that the version requested is >= 1.1. */
58  /* The low byte is the major version and the high */
59  /* byte is the minor version. */
60  if (LOBYTE (wVersionRequested) < 1 || (LOBYTE (wVersionRequested) == 1 && HIBYTE (wVersionRequested) < 1))
61  {
62  return -1;
63  }
64  /* Since we only support 1.1, set both wVersion and */
65  /* wHighVersion to 1.1. */
66  /*
67  * lpWsaData->wVersion = MAKEWORD( 1, 1 ); lpWsaData->wHighVersion = MAKEWORD( 1, 1 ); */
68 
69  return 0;
70 }
int wsa_initialize()
#define err(fd,...)
Definition: porting.h:431