packets/packet_cache.h

Go to the documentation of this file.
00001 #ifndef HLBR_PACKET_CACHE_H
00002 #define HLBR_PACKET_CACHE_H
00003 
00004 #include "../config.h"
00005 #include "../engine/hlbr.h"
00006 
00007 #define MAX_QUERY_RESULTS       128
00008 #define MAX_SAVES                       1024
00009 #define MAX_SAVES_PER_BIN       128
00010 
00011 typedef struct save_rec{
00012         char                            InUse;
00013         
00014         char*                           Key;
00015         int                                     KeyLen;
00016         int                                     Timeout;
00017         int                                     PacketSlot;     
00018         int                                     PacketID;
00019         pthread_mutex_t         Mutex;
00020         int                                     LockID;
00021         
00022         int                                     NextTime;
00023         int                                     PrevTime;
00024 } SaveRec;
00025 
00026 typedef struct save_bin{
00027         unsigned char   NumInBin;
00028         int                             Items[MAX_SAVES_PER_BIN];
00029 }SaveBin;
00030 
00031 typedef struct save_query{
00032         int                     NumResults;
00033         int                     Saves[MAX_QUERY_RESULTS];
00034         int                     Packets[MAX_QUERY_RESULTS];
00035 } SaveQuery;
00036 
00037 
00038 int InitCache();
00039 int SavePacket(int PacketSlot, char* Key, int KeyLen, int timeout);
00040 SaveQuery* GetAndLockSavedPackets(char* Key, int KeyLen);
00041 void UnlockSavedQuery(SaveQuery* q);
00042 void FreeSaveQuery(SaveQuery* q);
00043 
00044 
00045 #endif

Generated on Sat Jul 7 23:33:10 2007 for HLBR by  doxygen 1.5.2