00001 #ifndef UTIL_H 00002 #define UTIL_H 00003 00004 #include<vector> 00005 00006 00011 typedef std::pair<uint32_t, uint16_t> AddressPortPair; 00012 00016 int GetFileSize(const std::string& sFile); 00017 00021 std::string GetDotFormatIP(uint32_t ip); 00022 00023 00027 void reuse(int fd); 00028 00032 void nonblock(int fd); 00033 00037 void nodelay(int fd); 00038 void ByteOrderTesting(); 00039 00043 int RunAsDaemon(const char* stdoutname); 00044 int write_pid(const char * sFileName); 00045 00050 AddressPortPair GetSockName(uint32_t sock); 00051 00055 int StringTokenizer(const std::string sToParse, const char* cToken, std::vector<std::string>& v); 00056 00057 00058 00059 00060 00061 00062 #endif//UTIL_H