00001 #ifndef __SOCKET_LIB_H
00002 #define __SOCKET_LIB_H
00003
00004
00005
00017 #include <stdlib.h>
00018 #include <sys/socket.h>
00019 #include <sys/types.h>
00020 #include <netinet/in.h>
00021 #include <signal.h>
00022 #include <string.h>
00023 #include <arpa/inet.h>
00024 #include <errno.h>
00025 #include "log_lib.h"
00026
00027 #define SOCKET_LIB_LOG_BUFF_SIZE 200
00028
00029 #define SOCKET_LIB_NAME "socket_lib"
00030 #define SOCKET_LIB_LOG_FILE "socket_lib.log"
00031
00032 #define SOCKET_LOGMESSAGE(string, location) logmessage(string, location ,\
00033 SOCKET_LIB_NAME, SOCKET_LIB_LOG_FILE, __FILE__, __LINE__,\
00034 __FUNCTION__);
00035
00036
00050 int accept_connect(int sock);
00051
00052
00053
00069 int create_connect(struct in_addr *ipaddr, short port);
00070
00071
00072
00090 int create_serv_socket(int port, int queue_len);
00091
00092
00093
00116 int safe_sock_send(int sock, void *send_buff, unsigned int send_len,
00117 unsigned int timeout);
00118
00119
00120
00121
00144 int safe_sock_recv(int sock,void *recv_buff, unsigned int recv_len,
00145 unsigned int timeout);
00146
00149 #endif