forked from noah-/d2bs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSSocket.h
More file actions
34 lines (23 loc) · 1.32 KB
/
JSSocket.h
File metadata and controls
34 lines (23 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __JSSOCKET_H__
#define __JSSOCKET_H__
#include "js32.h"
//////////////////////////////////////////////////////////////////
// socket stuff
//////////////////////////////////////////////////////////////////
CLASS_CTOR(socket);
JSBool socket_equality(JSContext* cx, JSObject* obj, jsval v, JSBool* bp);
JSAPI_PROP(socket_getProperty);
JSAPI_STRICT_PROP(socket_setProperty);
JSAPI_FUNC(socket_open);
JSAPI_FUNC(socket_close);
JSAPI_FUNC(socket_send);
JSAPI_FUNC(socket_read);
void socket_finalize(JSFreeOp* fop, JSObject* obj);
enum { SOCKET_READABLE, SOCKET_WRITEABLE };
static JSFunctionSpec socket_methods[] = {JS_FN("close", socket_close, 0, FUNCTION_FLAGS), JS_FN("send", socket_send, 1, FUNCTION_FLAGS),
JS_FN("read", socket_read, 0, FUNCTION_FLAGS), JS_FS_END};
static JSFunctionSpec socket_s_methods[] = {JS_FN("open", socket_open, 2, FUNCTION_FLAGS), JS_FS_END};
static JSPropertySpec socket_props[] = {{"readable", SOCKET_READABLE, JSPROP_PERMANENT_VAR, JSOP_WRAPPER(socket_getProperty), JSOP_NULLWRAPPER},
{"writeable", SOCKET_WRITEABLE, JSPROP_PERMANENT_VAR, JSOP_WRAPPER(socket_getProperty), JSOP_NULLWRAPPER},
{0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}};
#endif