From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/3rdparty/tekcos/tekcos.h | 93 ------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 src/libjin/3rdparty/tekcos/tekcos.h (limited to 'src/libjin/3rdparty/tekcos/tekcos.h') diff --git a/src/libjin/3rdparty/tekcos/tekcos.h b/src/libjin/3rdparty/tekcos/tekcos.h deleted file mode 100644 index cddc8f3..0000000 --- a/src/libjin/3rdparty/tekcos/tekcos.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _TEKCOS_H -#define _TEKCOS_H - -#if defined(_WIN32) -#include -#include -#else -#include -#include -#include -#include -#endif - -#define TK_VERSION "0.1.0" - -typedef unsigned int uint32; -typedef unsigned short uint16; - -#ifdef _WIN32 -// neccessary for windows -int tk_init(); -#endif -// Under AF_INET domain, we use 32bit host + 16bit port to -// locate a proccess. -typedef struct -{ - uint32 host; // 32bit ip - uint16 port; // 16 bit port -} tk_IPaddress; - -uint32 tk_strtohl(const char* str); // string to host long(32 bits) -const char* tk_hltostr(uint32 ip); // host long to string -#define tk_htons htons // host to network short(16 bits) -#define tk_ntohl ntohl // network to host long(32bits) - -/* -* TCP socket -* type = SOCK_STREAM -* protocol = IPPROTO_TCP -*/ - -#ifdef __linux__ -typedef unsigned int SOCKET; -#endif -// TCP socket structrue. -typedef struct -{ - SOCKET id; // socket id - int type; // socket type - tk_IPaddress remote; // remote ip - tk_IPaddress local; // local ip -} tk_TCPsocket; - -// create a tcp socket. if ip.host is INADDR_NONE or -// INADDR_ANY, creeate a listenning server socket, -// otherwise, connect to a remote server with given -// ip address. -tk_TCPsocket tk_tcp_open(tk_IPaddress ip); -int tk_tcp_close(tk_TCPsocket* sk); -int tk_tcp_send(tk_TCPsocket* client, const void* buffer, int bsize, int* len); -int tk_tcp_recv(tk_TCPsocket* client, char* buffer, int bsize, int* len); -tk_TCPsocket tk_tcp_accept(tk_TCPsocket* server); -int tk_tcp_nonblocking(tk_TCPsocket* sk); -int tk_tcp_blocking(tk_TCPsocket* sk); - -/* -* UDP socket -* type = SOCK_DGRAM -* protocol = IPPTOTO_UDP -*/ - -// UDP socket structure. -typedef struct -{ - SOCKET id; // socket id -} tk_UDPsocket; - -typedef struct -{ - tk_IPaddress ip; // recvfrom or sendto ip addreass - int len; // length of data - char* data; // data -}tk_UDPpack; - -tk_UDPsocket tk_udp_open(uint16 portnumber); -int tk_udp_close(tk_UDPsocket* sk); -int tk_udp_sendto(tk_UDPsocket* sk, tk_UDPpack* pack); -int tk_udp_recvfrom(tk_UDPsocket* sk, tk_UDPpack* pack); -int tk_freepack(tk_UDPpack* pack); -// Get error message if some errors occured. -const char* tk_errmsg(); - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0