00001 #ifndef UTIL_H 00002 #define UTIL_H 00003 00004 #include<vector> 00005 00014 typedef std::pair<uint32_t, uint16_t> AddressPortPair; 00015 00019 int GetFileSize(const std::string& sFile); 00020 00024 std::string GetDotFormatIP(uint32_t ip); 00025 00029 void reuse(int fd); 00030 00034 void nonblock(int fd); 00035 00039 void nodelay(int fd); 00040 void ByteOrderTesting(); 00041 00046 int RunAsDaemon(const char* stdoutname); 00047 00051 int write_pid(const char * sFileName); 00052 00056 AddressPortPair GetSockName(uint32_t sock); 00057 00061 int StringTokenizer(const std::string sToParse, const char* cToken, std::vector<std::string>& v); 00062 00063 00064 00065 00066 00067 00068 #endif//UTIL_H