Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

viaInNetSock.h

00001 
00006 #include "viaNetManager.h"
00007 #include "Packet.h"
00008 
00009 #define INDATASIZE 10
00010 
00011 #ifndef VIAINNETSOCK_H
00012 #define VIAINNETSOCK_H
00013 
00014 #include <netinet/in.h>
00015 #include <pthread.h>
00016 #include "sysLog.h"
00017 
00018 class ViaInNetSock {
00019         public:
00023         enum Status {
00025             OPEN = 1,
00027             CLOSED = 0,
00029             LISTENING = 2,
00031             ERROR = -1
00032         };
00033 
00037                 static void getPacket();        
00038 
00045                 int openInNet(struct sockaddr_in address);
00046 
00052         int closeInNet();
00053         
00058         Status getStatus();
00059         
00064                 void setStatus(Status newStatus);
00065 
00070         static ViaInNetSock * theInstance();
00071 
00076                 void setCliSock(int newSock);
00077 
00082                 inline int getInSock() {return inSock;}
00083                 
00088         inline int getCliSock() {return cliSock;}
00089                 
00094         inline struct sockaddr_in* getCliAddr(){&cliAddr;}
00095                 
00101         Packet * searchForReply(int ID);
00102                 
00107                 void recReply(Packet * packet);
00108 
00109         protected:
00113                 ViaInNetSock();
00114 
00118                 ~ViaInNetSock();
00119 
00120                 //returns a pointer to the array which holds the incomming data
00121                 inline Packet * getInFile(){return inData[0];}
00122 
00123         private:
00125                 SysLog * systemLogger;  
00126                 
00128                 static ViaInNetSock * instance;
00129                   
00131                 int inSock;
00132 
00133                 int cliSock;
00134 
00136                 Packet *inData[INDATASIZE];
00137                 
00139                 static Status status;
00140 
00142                 pthread_t inThread;
00143                 
00145                 struct sockaddr_in cliAddr;
00146         struct sockaddr_in serAddr;
00147                 
00151                 int writeSem;
00152 };
00153 
00154 #endif //VIAINNETSOCK_HSD

Generated on Fri Mar 25 23:48:45 2005 for CS498EmbeddedSystemsProgramming by doxygen 1.3.6