//******************************************** // IPC.h // ------------------------------------------- // Data types and function declarations related // to IPC (Inter-process Communication) between // AEI and AE // // Author: Leiwen Deng // Date: 12/10/2005 //******************************************** #ifndef IPC_H #define IPC_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TRACE_BASED_TEST // define this macro to enable trace_based test mode #define AE_PID_FILE_NAME "/usr/local/squid/var/logs/AE.pid" // the file that records the pid of AE process #define MAX_VALUE_LENGTH 300 // maximum value length in a TLV // Type codes of TLV #define TLV_ACCESS_INFO 1 // Access information ( AEI --> AE ) #define TLV_BLOCK_ENTRY 2 // Block-entry Request ( AEI <-- AE ) #define TLV_BLOCK_CLIENT 3 // Block-client Request ( AEI <-- AE ) #define TLV_RELEASE_ENTRY 4 // Storage-release Notification ( AEI --> AE ) // The TLV type typedef struct{ short type; short length; void * value; }IPC_TLV; #ifndef MD5_DIGEST_CHARS #define MD5_DIGEST_CHARS 16 #endif #define AFLAG_CACHED 0x1 #define AFLAG_POLLUTION 0x2 // The access information data type typedef struct{ struct in_addr client_address; int current_time_sec; int current_time_usec; int duration; int result_code; int received_bytes; char md5key[MD5_DIGEST_CHARS]; time_t lastref; u_short refcount; int flag; }ACCESS_INFO; // The entry information data type typedef struct{ char md5key[MD5_DIGEST_CHARS]; }ENTRY_INFO; // The client information data type typedef struct{ struct in_addr ip; }CLIENT_INFO; // Send a TLV to an output stream char SendTLV( const IPC_TLV * tlv, FILE * fp ); // Receive a TLV from an input stream char ReceiveTLV( IPC_TLV * tlv, FILE * fp ); // Print a formatted message to the log file and then terminate the program void Die( const char * format, ... ); // Print a formatted message to the log file void LogPrintf( const char * format, ... ); // Flush the log file if necessary void LogFlush( void ); #endif