2 * Copyright (c) 2016 rxi
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the MIT license. See LICENSE for details.
14 #include <windows.h> /* For SOCKET */
23 typedef SOCKET dyad_Socket
;
25 typedef int dyad_Socket
;
29 typedef struct dyad_Stream dyad_Stream
;
41 typedef void (*dyad_Callback
)(dyad_Event
*);
42 typedef void (*dyad_PanicCallback
)(const char*);
62 DYAD_STATE_CONNECTING
,
69 void dyad_update(void);
70 void dyad_shutdown(void);
71 const char *dyad_getVersion(void);
72 double dyad_getTime(void);
73 int dyad_getStreamCount(void);
74 void dyad_setTickInterval(double seconds
);
75 void dyad_setUpdateTimeout(double seconds
);
76 dyad_PanicCallback
dyad_atPanic(dyad_PanicCallback func
);
78 dyad_Stream
*dyad_newStream(void);
79 int dyad_listen(dyad_Stream
*stream
, int port
);
80 int dyad_listenEx(dyad_Stream
*stream
, const char *host
, int port
,
82 int dyad_connect(dyad_Stream
*stream
, const char *host
, int port
);
83 void dyad_addListener(dyad_Stream
*stream
, int event
,
84 dyad_Callback callback
, void *udata
);
85 void dyad_removeListener(dyad_Stream
*stream
, int event
,
86 dyad_Callback callback
, void *udata
);
87 void dyad_removeAllListeners(dyad_Stream
*stream
, int event
);
88 void dyad_end(dyad_Stream
*stream
);
89 void dyad_close(dyad_Stream
*stream
);
90 void dyad_write(dyad_Stream
*stream
, const void *data
, int size
);
91 void dyad_vwritef(dyad_Stream
*stream
, const char *fmt
, va_list args
);
92 void dyad_writef(dyad_Stream
*stream
, const char *fmt
, ...);
93 void dyad_setTimeout(dyad_Stream
*stream
, double seconds
);
94 void dyad_setNoDelay(dyad_Stream
*stream
, int opt
);
95 int dyad_getState(dyad_Stream
*stream
);
96 const char *dyad_getAddress(dyad_Stream
*stream
);
97 int dyad_getPort(dyad_Stream
*stream
);
98 int dyad_getBytesSent(dyad_Stream
*stream
);
99 int dyad_getBytesReceived(dyad_Stream
*stream
);
100 dyad_Socket
dyad_getSocket(dyad_Stream
*stream
);