Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cpmsocket.h

Go to the documentation of this file.
00001 #ifndef _C_PM_SOCKET_H_
00002 #define _C_PM_SOCKET_H_
00003 
00004 #include <stdint.h>
00005 #include <sys/types.h>
00006 #include <sys/socket.h>
00007 #include <netinet/in.h>
00008 
00009 #define PMSOCKET_ERROR -1
00010 #ifndef _PM_BYTE_TYPE_
00011 #define _PM_BYTE_TYPE_
00012         typedef unsigned char byte;
00013 #endif
00014 
00015         typedef enum {TCP, UDP} transport;
00016 
00017 typedef struct {
00018         int socketFD;
00019         struct sockaddr_in addr;
00020         transport trans;
00021 } PMSocket;
00022 
00023 PMSocket *pmsocket_open(const char *address, uint16_t port, transport trans);
00024 PMSocket *pmsocket_connect(const char *address, uint16_t port);
00025 PMSocket *pmsocket_accept(PMSocket *pmSocket, int queue);
00026 int pmsocket_close(PMSocket *pmSocket);
00027 int pmsocket_send(const PMSocket *pmSocket, const byte *data, uint32_t length);
00028 PMSocket *pmsocket_recv(const PMSocket *pmSocket, byte *data, uint32_t length, PMSocket *sender);
00029 
00030 
00031 #endif

Generated on Mon Dec 1 17:00:22 2003 for Protomake by doxygen1.3