OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2011 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can | |
4 * be found in the LICENSE file. | |
5 */ | |
6 | |
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_DEBUG_STUB_DEBUG_SOCKET_IMPL_H_ | |
8 #define NATIVE_CLIENT_SRC_TRUSTED_DEBUG_STUB_DEBUG_SOCKET_IMPL_H_ 1 | |
9 | |
10 | |
11 #include "native_client/src/include/portability.h" | |
12 | |
13 EXTERN_C_BEGIN | |
14 | |
15 // Maximum string length of a Network Address | |
16 // For IPv4 addresses this is really only xxx.xxx.xxx.xxx:yyyyy | |
17 // But we allow larger to deal with name resolution in the future | |
18 #define MAX_ADDR_LEN 256 | |
19 | |
20 typedef enum { | |
21 DSE_ERROR = -1, | |
22 DSE_TIMEOUT = 0, | |
23 DSE_OK = 1 | |
24 } DSError; | |
25 | |
26 #define DEBUG_SOCKET_BAD ((void *) -1) | |
27 typedef void *DSHandle; | |
28 | |
29 // Platform dependant calls | |
30 DSError DebugSocketInit(); | |
31 DSError DebugSocketExit(); | |
32 DSError DebugSocketCreate(DSHandle *handle); | |
33 DSError DebugSocketClose(DSHandle handle); | |
34 int DebugSocketGetError(int can_block); | |
35 | |
36 // Platform independant calls | |
37 DSError DebugSocketAccept(DSHandle srv, DSHandle *sock, char *addr, uint32_t max
); | |
38 DSError DebugSocketBind(DSHandle handle, const char *addr); | |
39 DSError DebugSocketConnect(DSHandle handle, const char *addr); | |
40 DSError DebugSocketListen(DSHandle handle, uint32_t cnt); | |
41 DSError DebugSocketRecv(DSHandle handle, void *data, int32_t max, int32_t *len); | |
42 DSError DebugSocketSend(DSHandle handle, void *data, int32_t max, int32_t *len); | |
43 DSError DebugSocketRecvAvail(DSHandle handle, uint32_t ms_usec); | |
44 DSError DebugSocketSendAvail(DSHandle handle, uint32_t ms_usec); | |
45 | |
46 DSError DebugSocketStrToAddr(const char *saddr, void *daddr, uint32_t len); | |
47 DSError DebugSocketAddrToStr(void *saddr, uint32_t len, char *daddr, uint32_t ma
x); | |
48 DSError DebugSocketAddrSize(uint32_t *len); | |
49 DSError DebugSocketLogError(const char *file, int line, int block_ok); | |
50 | |
51 EXTERN_C_END | |
52 | |
53 #endif | |
54 | |
OLD | NEW |