41 lines
825 B
C
41 lines
825 B
C
#ifndef _LIB_H_
|
|
|
|
#define _LIB_H_
|
|
|
|
|
|
#define BUFSIZE 20
|
|
|
|
|
|
// debug flags
|
|
#define DEBUG 0x1
|
|
#define DEBUG_LEN 40
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <arpa/inet.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <netdb.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
/************************************************
|
|
**** Signatures ****
|
|
************************************************/
|
|
|
|
int debug(const char* tag, const char* msg);
|
|
|
|
int xbind(const int port);
|
|
int xlisten(const int xsocket, struct sockaddr_in* client);
|
|
|
|
int xconnect(const char* hostname, const int port, struct sockaddr_in* serv);
|
|
|
|
int xread(const int xsocket, char* buffer, int bufsize);
|
|
int xwrite(const int xsocket, char* buffer);
|
|
#endif
|