56 lines
1 KiB
C
56 lines
1 KiB
C
#ifndef __CLIENT__
|
|
#define __CLIENT__
|
|
|
|
#define DEF_BUFFERSIZE 2048 // Buffergröße für ein Packet
|
|
|
|
#ifndef LWIP_SOCKET
|
|
#include <lwip/sockets.h>
|
|
#endif
|
|
|
|
#ifndef SOCKET
|
|
#define SOCKET int
|
|
#endif
|
|
|
|
|
|
#include <metalsvm/tasks.h>
|
|
|
|
|
|
typedef struct _ClientEventArgs
|
|
{
|
|
unsigned int dwLen;
|
|
void* pBuffer;
|
|
} ClientEventArgs;
|
|
|
|
|
|
typedef void (*ClientEventHandler)(ClientEventArgs*);
|
|
|
|
|
|
typedef struct _Client
|
|
{
|
|
//Connection Handling
|
|
SOCKET sSocket;
|
|
|
|
struct sockaddr_in adAddr;
|
|
|
|
//Output Interfacte
|
|
unsigned short wPort;
|
|
|
|
tid_t bThread;
|
|
|
|
// Eventhandling
|
|
ClientEventHandler _OnConnect;
|
|
ClientEventHandler _OnDisconnect;
|
|
ClientEventHandler _OnRead;
|
|
ClientEventHandler _OnWrite;
|
|
} Client;
|
|
|
|
int cli_sendBuffer(Client* cli,void* pBuffer, unsigned int bufferlen);
|
|
int cli_ConnectTo(Client* cli,char * pAdresse,unsigned short Port,int webAdresse);
|
|
int cli_DisconnectFrom(Client* cli);
|
|
void cli_WaitForPacket(Client* cli);
|
|
|
|
cli_init(Client* cli);
|
|
cli_destroy(Client* cli);
|
|
|
|
|
|
#endif
|