00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef EXTERNAL_COMM_H_INCLUDED
00033 #define EXTERNAL_COMM_H_INCLUDED
00034
00035 #include <sys/types.h>
00036 #include <sys/socket.h>
00037 #include <netinet/in.h>
00038 #include <netdb.h>
00039 #include <unistd.h>
00040 #include <errno.h>
00041 #include <pthread.h>
00042
00043 #define COMMAND_PORT 10584
00044 #define EVENT_PORT 10585
00045 #define MAX_CLIENT_CONNECTIONS 4
00046
00047 norace static int socketsInitialized = 0;
00048 void initializeSockets();
00049 int readTossimCommand(int clifd, int clidx);
00050 void buildTossimEvent(uint16_t moteID, uint16_t type, long long ftime, void *data,
00051 unsigned char **msgp, int *lenp);
00052 void sendTossimEvent(uint16_t moteID, uint16_t type, long long ftime, void *data);
00053 int writeTossimEvent(void *data, int datalen, int clifd);
00054
00055 int notifyTaskPosted(char* task);
00056 int notifyEventSignaled(char* event);
00057 int notifyCommandCalled(char* command);
00058 char* currentTime();
00059 int printTime(char* buf, int len);
00060 int printOtherTime(char* buf, int len, long long int ftime);
00061
00062 #endif