NUGU SDK Linux  1.7.6
nugu_winsock.h
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
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 __NUGU_WINSOCKET_H__
18 #define __NUGU_WINSOCKET_H__
19 
20 #include <nugu.h>
21 
22 #if defined(_WIN32) || defined(__MSYS__)
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
40 typedef enum _nugu_winsock_type {
41  NUGU_WINSOCKET_SERVER,
42  NUGU_WINSOCKET_CLIENT,
43 } NuguWinSocketType;
44 
48 typedef struct _nugu_winsock_t NuguWinSocket;
49 
56 NUGU_API int nugu_winsock_init(void);
57 
61 NUGU_API void nugu_winsock_deinit(void);
62 
68 NUGU_API NuguWinSocket *nugu_winsock_create(void);
69 
75 NUGU_API void nugu_winsock_remove(NuguWinSocket *wsock);
76 
84 NUGU_API int nugu_winsock_get_handle(NuguWinSocket *wsock,
85  NuguWinSocketType type);
86 
94 NUGU_API int nugu_winsock_check_for_data(int handle);
95 
104 NUGU_API int nugu_winsock_read(int handle, char *buf, int len);
105 
114 NUGU_API int nugu_winsock_write(int handle, const char *buf, int len);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif // _WIN32 || __MSYS__
121 
122 #endif // __NUGU_WINSOCKET_H__