CARS

/home/nicola/Dropbox/Progetto SOL/CARS_terfram/src/comsock.h

Go to the documentation of this file.
00001 
00007 #ifndef _COMSOCK_H
00008 #define _COMSOCK_H
00009 
00010 /* -= TIPI =- */
00011 
00020 typedef struct {
00021     char type;           
00022     unsigned int length; 
00023     char* buffer;        
00024 } message_t; 
00025 
00027 #define UNIX_PATH_MAX    108
00028 
00029 
00031 #define  NTRIALCONN 3
00032 
00034 #define  SEC_TIMER 30
00035 
00037 #define  LUSERNAME 25
00038 
00041 #define MSG_CONNECT      'C' 
00042 
00043 #define MSG_OK           'K' 
00044 
00045 #define MSG_NO           'N' 
00046 
00047 #define MSG_REQUEST      'R' 
00048 
00049 #define MSG_OFFER        'F' 
00050 
00051 #define MSG_EXIT         'X' 
00052 
00053 #define MSG_SHARE        'S' 
00054 
00055 #define MSG_SHAREND     'H' 
00056 
00057 
00058 
00059 /* -= FUNZIONI =- */
00069 int createServerChannel(char* path);
00070 
00077 int closeSocket(int s);
00078 
00085 int acceptConnection(int s);
00086 
00099 int receiveMessage(int sc, message_t * msg);
00100 
00110 int sendMessage(int sc, message_t *msg);
00111 
00122 int openConnection(char* path);
00123 
00124 #endif