Changeset 732
- Timestamp:
- 02/03/12 19:47:41 (4 months ago)
- Location:
- trunk/sources/common
- Files:
-
- 30 edited
-
include/defines.h (modified) (5 diffs)
-
include/platform/dfreebsd/dfreebsdplatform.h (modified) (1 diff)
-
include/platform/freebsd/freebsdplatform.h (modified) (1 diff)
-
include/platform/linux/linuxplatform.h (modified) (1 diff)
-
include/platform/openbsd/openbsdplatform.h (modified) (1 diff)
-
include/platform/osx/osxplatform.h (modified) (1 diff)
-
include/platform/solaris/solarisplatform.h (modified) (1 diff)
-
include/platform/windows/max.h (modified) (2 diffs)
-
include/platform/windows/win32platform.h (modified) (5 diffs)
-
include/utils/buffering/iobuffer.h (modified) (1 diff)
-
include/utils/logging/logger.h (modified) (1 diff)
-
include/utils/lua/luautils.h (modified) (2 diffs)
-
include/utils/misc/timersmanager.h (modified) (1 diff)
-
include/utils/misc/variant.h (modified) (2 diffs)
-
src/platform/android/androidplatform.cpp (modified) (1 diff)
-
src/platform/dfreebsd/dfreebsdplatform.cpp (modified) (1 diff)
-
src/platform/freebsd/freebsdplatform.cpp (modified) (1 diff)
-
src/platform/linux/linuxplatform.cpp (modified) (1 diff)
-
src/platform/openbsd/openbsdplatform.cpp (modified) (1 diff)
-
src/platform/osx/osxplatform.cpp (modified) (1 diff)
-
src/platform/solaris/solarisplatform.cpp (modified) (1 diff)
-
src/platform/windows/win32platform.cpp (modified) (4 diffs)
-
src/utils/buffering/iobuffer.cpp (modified) (1 diff)
-
src/utils/logging/logger.cpp (modified) (1 diff)
-
src/utils/lua/luautils.cpp (modified) (6 diffs)
-
src/utils/mempool/mempool.cpp (modified) (1 diff)
-
src/utils/misc/file.cpp (modified) (2 diffs)
-
src/utils/misc/timersmanager.cpp (modified) (6 diffs)
-
src/utils/misc/uri.cpp (modified) (1 diff)
-
src/utils/misc/variant.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/common/include/defines.h
r696 r732 323 323 #define CONF_PROTOCOL_RTSP_RTCP "inboundRtspRtcp" 324 324 #define CONF_PROTOCOL_RTSP_RTCP_LEN 15 325 #define CONF_PROTOCOL_TCP_PASSTHROUGH "tcpPassThrough" 326 #define CONF_PROTOCOL_TCP_PASSTHROUGH_LEN 14 327 #define CONF_PROTOCOL_UDP_PASSTHROUGH "udpPassThrough" 328 #define CONF_PROTOCOL_UDP_PASSTHROUGH_LEN 14 325 329 #define CONF_PROTOCOL_UDP_RTCP "inboundUdpRtcp" 326 330 #define CONF_PROTOCOL_UDP_RTCP_LEN 14 … … 373 377 #define HTTP_HEADERS_SERVER "Server" 374 378 #define HTTP_HEADERS_SERVER_LEN 6 375 #define HTTP_HEADERS_SERVER_US " C++ RTMP Server (http://www.rtmpd.com)"376 #define HTTP_HEADERS_SERVER_US_LEN 38379 #define HTTP_HEADERS_SERVER_US "EVOSTREAM Streaming Router (www.evostream.com)" 380 #define HTTP_HEADERS_SERVER_US_LEN 46 377 381 #define HTTP_HEADERS_TRANSFER_ENCODING "Transfer-Encoding" 378 382 #define HTTP_HEADERS_TRANSFER_ENCODING_LEN 17 … … 385 389 #define HTTP_HEADERS_X_POWERED_BY "X-Powered-By" 386 390 #define HTTP_HEADERS_X_POWERED_BY_LEN 12 387 #define HTTP_HEADERS_X_POWERED_BY_US " C++ RTMP Server (http://www.rtmpd.com)"388 #define HTTP_HEADERS_X_POWERED_BY_US_LEN 38391 #define HTTP_HEADERS_X_POWERED_BY_US "EVOSTREAM Streaming Router (www.evostream.com)" 392 #define HTTP_HEADERS_X_POWERED_BY_US_LEN 46 389 393 #define HTTP_METHOD "method" 390 394 #define HTTP_METHOD_LEN 6 … … 743 747 #define RTSP_HEADERS_SERVER "Server" 744 748 #define RTSP_HEADERS_SERVER_LEN 6 745 #define RTSP_HEADERS_SERVER_US " C++ RTMP Server (http://www.rtmpd.com)"746 #define RTSP_HEADERS_SERVER_US_LEN 38749 #define RTSP_HEADERS_SERVER_US "EVOSTREAM Streaming Router (www.evostream.com)" 750 #define RTSP_HEADERS_SERVER_US_LEN 46 747 751 #define RTSP_HEADERS_SESSION "Session" 748 752 #define RTSP_HEADERS_SESSION_LEN 7 … … 751 755 #define RTSP_HEADERS_X_POWERED_BY "X-Powered-By" 752 756 #define RTSP_HEADERS_X_POWERED_BY_LEN 12 753 #define RTSP_HEADERS_X_POWERED_BY_US " C++ RTMP Server (http://www.rtmpd.com)"754 #define RTSP_HEADERS_X_POWERED_BY_US_LEN 38757 #define RTSP_HEADERS_X_POWERED_BY_US "EVOSTREAM Streaming Router (www.evostream.com)" 758 #define RTSP_HEADERS_X_POWERED_BY_US_LEN 46 755 759 #define RTSP_METHOD "method" 756 760 #define RTSP_METHOD_LEN 6 -
trunk/sources/common/include/platform/dfreebsd/dfreebsdplatform.h
r703 r732 193 193 void installQuitSignal(SignalFnc pQuitSignalFnc); 194 194 void installConfRereadSignal(SignalFnc pConfRereadSignalFnc); 195 196 197 195 #endif /* _DFREEBSDPLATFORM_H */ 198 196 #endif /* DFREEBSD */ -
trunk/sources/common/include/platform/freebsd/freebsdplatform.h
r703 r732 193 193 void installQuitSignal(SignalFnc pQuitSignalFnc); 194 194 void installConfRereadSignal(SignalFnc pConfRereadSignalFnc); 195 196 197 195 #endif /* _FREEBSDPLATFORM_H */ 198 196 #endif /* FREEBSD */ -
trunk/sources/common/include/platform/linux/linuxplatform.h
r703 r732 197 197 void installQuitSignal(SignalFnc pQuitSignalFnc); 198 198 void installConfRereadSignal(SignalFnc pConfRereadSignalFnc); 199 200 199 #endif /* _LINUXPLATFORM_H */ 201 200 #endif /* LINUX */ -
trunk/sources/common/include/platform/openbsd/openbsdplatform.h
r703 r732 195 195 void installQuitSignal(SignalFnc pQuitSignalFnc); 196 196 void installConfRereadSignal(SignalFnc pConfRereadSignalFnc); 197 198 199 197 #endif /* _OPENBSDPLATFORM_H */ 200 198 #endif /* OPENBSD */ -
trunk/sources/common/include/platform/osx/osxplatform.h
r703 r732 193 193 void installQuitSignal(SignalFnc pQuitSignalFnc); 194 194 void installConfRereadSignal(SignalFnc pConfRereadSignalFnc); 195 196 197 195 #endif /* _OSXPLATFORM_H */ 198 196 #endif /* OSX */ -
trunk/sources/common/include/platform/solaris/solarisplatform.h
r703 r732 198 198 int vasprintf(char **ret, const char *format, va_list args); 199 199 int asprintf(char **strp, const char *fmt, ...); 200 201 200 #endif /* _SOLARISPLATFORM_H */ 202 201 #endif /* SOLARIS */ -
trunk/sources/common/include/platform/windows/max.h
r56 r732 22 22 #define _MAX_H 23 23 24 #include <stdint.h> 25 26 /* 24 27 #ifdef UINT64_MAX 25 28 #undef UINT64_MAX … … 103 106 #define INT8_MIN ((int8_t)(0x80)) 104 107 #endif 108 */ 105 109 106 110 #endif /* _MAX_H */ -
trunk/sources/common/include/platform/windows/win32platform.h
r702 r732 107 107 #include <cctype> 108 108 #include <algorithm> 109 #include <stdint.h> 109 110 using namespace std; 110 111 111 typedef unsigned char uint8_t;112 /*typedef unsigned char uint8_t; 112 113 typedef unsigned short int uint16_t; 113 114 typedef unsigned long int uint32_t; … … 116 117 typedef short int int16_t; 117 118 typedef long int int32_t; 118 typedef long long int int64_t; 119 typedef long long int int64_t;*/ 119 120 #define atoll atol 120 121 … … 135 136 #define READ_FD _read 136 137 #define WRITE_FD _write 137 #define CLOSE_SOCKET(fd) if((fd)>=0) closesocket((fd))138 #define CLOSE_SOCKET(fd) do{ if(fd>=0) closesocket(fd);fd=-1;}while(0) 138 139 #define LASTSOCKETERROR WSAGetLastError() 139 140 #define SOCKERROR_CONNECT_IN_PROGRESS WSAEWOULDBLOCK 140 141 #define SOCKERROR_SEND_IN_PROGRESS WSAEWOULDBLOCK 142 #define SOCKERROR_RECV_IN_PROGRESS WSAEWOULDBLOCK 143 #define SOCKERROR_RECV_CONN_RESET WSAECONNRESET 141 144 #define SET_UNKNOWN 0 142 145 #define SET_READ 1 … … 229 232 DLLEXP bool deleteFile(string path); 230 233 DLLEXP bool deleteFolder(string path, bool force); 234 DLLEXP bool createFolder(string path, bool recursive); 231 235 DLLEXP string getHostByName(string name); 232 236 DLLEXP bool isNumeric(string value); … … 257 261 DLLEXP HMODULE UnicodeLoadLibrary(string fileName); 258 262 DLLEXP int inet_aton(const char *pStr, struct in_addr *pRes); 259 260 261 263 #endif /* _WIN32PLATFORM_H */ 262 264 #endif /* WIN32 */ -
trunk/sources/common/include/utils/buffering/iobuffer.h
r712 r732 207 207 */ 208 208 209 static string DumpBuffer( uint8_t *pBuffer, uint32_t length);209 static string DumpBuffer(const uint8_t *pBuffer, uint32_t length); 210 210 string ToString(uint32_t startIndex = 0, uint32_t limit = 0); 211 211 operator string(); -
trunk/sources/common/include/utils/logging/logger.h
r633 r732 50 50 static bool AddLogLocation(BaseLogLocation *pLogLocation); 51 51 static void SignalFork(); 52 static void SetLevel(int32_t level); 52 53 }; 53 54 -
trunk/sources/common/include/utils/lua/luautils.h
r422 r732 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 22 22 #define _LUAUTILS_H 23 23 24 extern "C" { 25 #include <lualib.h> 26 #include <lauxlib.h> 27 } 24 struct lua_State; 28 25 #include "platform/platform.h" 29 26 #include "utils/misc/variant.h" -
trunk/sources/common/include/utils/misc/timersmanager.h
r274 r732 48 48 vector<uint32_t> _periodsVector; 49 49 map<uint32_t, uint32_t> _periodsMap; 50 bool _inExecution; 51 vector<uint32_t> _pendingForRemoval; 50 52 public: 51 53 TimersManager(ProcessTimerEvent processTimerEvent); -
trunk/sources/common/include/utils/misc/variant.h
r625 r732 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 218 218 bool SerializeToJSON(string &result); 219 219 220 static bool DeserializeFromCmdLineArgs(uint32_t count, c har **pArguments,220 static bool DeserializeFromCmdLineArgs(uint32_t count, const char **pArguments, 221 221 Variant &result); 222 222 private: -
trunk/sources/common/src/platform/android/androidplatform.cpp
r722 r732 484 484 485 485 #endif /* ANDROID */ 486 -
trunk/sources/common/src/platform/dfreebsd/dfreebsdplatform.cpp
r722 r732 485 485 } 486 486 487 488 #endif /* FREEBSD */ 489 487 #endif /* DFREEBSD */ -
trunk/sources/common/src/platform/freebsd/freebsdplatform.cpp
r722 r732 500 500 } 501 501 502 503 502 #endif /* FREEBSD */ 504 -
trunk/sources/common/src/platform/linux/linuxplatform.cpp
r722 r732 500 500 501 501 #endif /* LINUX */ 502 -
trunk/sources/common/src/platform/openbsd/openbsdplatform.cpp
r722 r732 490 490 } 491 491 492 493 492 #endif /* OPENBSD */ 494 -
trunk/sources/common/src/platform/osx/osxplatform.cpp
r722 r732 504 504 } 505 505 506 507 506 #endif /* OSX */ 508 -
trunk/sources/common/src/platform/solaris/solarisplatform.cpp
r722 r732 532 532 533 533 #endif /* SOLARIS */ 534 -
trunk/sources/common/src/platform/windows/win32platform.cpp
r700 r732 59 59 60 60 bool fileExists(string path) { 61 char *lpStr2 = (char *) path.c_str(); 62 if (PathFileExists(lpStr2)) 61 #ifdef UNICODE 62 //TODO: Add the unicode implementation here 63 NYIR; 64 #else 65 if (PathFileExists(STR(path))) 63 66 return true; 64 67 else 65 68 return false; 69 #endif /* UNICODE */ 66 70 } 67 71 … … 263 267 264 268 bool setFdKeepAlive(int32_t fd) { 265 BOOL value = TRUE; 266 if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &value, sizeof (BOOL)) == SOCKET_ERROR) { 267 FATAL("Error #%u", WSAGetLastError()); 268 return false; 269 int value = 1; 270 if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &value, sizeof (int)) != 0) { 271 WARN("setsockopt failed with error #%u. This could be an UDP socket which on windows doesn't support SO_KEEPALIVE", WSAGetLastError()); 269 272 } 270 273 return true; … … 470 473 471 474 bool deleteFolder(string path, bool force) { 472 NYIA; 475 char fileFound[256]; 476 memset(fileFound, 0x00, sizeof (fileFound)); 477 WIN32_FIND_DATA info; 478 HANDLE hp; 479 sprintf(fileFound, "%s\\*.*", path.c_str()); 480 hp = FindFirstFile(fileFound, &info); 481 do { 482 if (!((strcmp(info.cFileName, ".") == 0) || 483 (strcmp(info.cFileName, "..") == 0))) { 484 if ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 485 FILE_ATTRIBUTE_DIRECTORY) { 486 string subFolder = path.c_str(); 487 subFolder.append("\\"); 488 subFolder.append(info.cFileName); 489 deleteFolder((char*) subFolder.c_str(), true); 490 RemoveDirectory(subFolder.c_str()); 491 } else { 492 sprintf(fileFound, "%s\\%s", path.c_str(), info.cFileName); 493 BOOL retVal = DeleteFile(fileFound); 494 } 495 } 496 497 } while (FindNextFile(hp, &info)); 498 FindClose(hp); 473 499 return false; 500 } 501 502 bool createFolder(string path, bool recursive) { 503 char DirName[256]; 504 char* p = (char*) path.c_str(); 505 char* q = DirName; 506 while (*p) { 507 if (('\\' == *p) || ('/' == *p)) { 508 if (':' != *(p - 1)) { 509 CreateDirectory(DirName, NULL); 510 } 511 } 512 *q++ = *p++; 513 *q = '\0'; 514 } 515 CreateDirectory(DirName, NULL); 516 return true; 474 517 } 475 518 … … 482 525 return true; 483 526 } 484 485 527 #endif /* WIN32 */ -
trunk/sources/common/src/utils/buffering/iobuffer.cpp
r722 r732 426 426 } 427 427 428 string IOBuffer::DumpBuffer( uint8_t *pBuffer, uint32_t length) {428 string IOBuffer::DumpBuffer(const uint8_t *pBuffer, uint32_t length) { 429 429 IOBuffer temp; 430 430 temp.ReadFromBuffer(pBuffer, length); -
trunk/sources/common/src/utils/logging/logger.cpp
r722 r732 150 150 } 151 151 } 152 153 void Logger::SetLevel(int32_t level) { 154 LOCK; 155 if (_pLogger == NULL) 156 return; 157 158 FOR_VECTOR(_pLogger->_logLocations, i) { 159 _pLogger->_logLocations[i]->SetLevel(level); 160 } 161 } -
trunk/sources/common/src/utils/lua/luautils.cpp
r646 r732 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 20 20 21 21 #ifdef HAS_LUA 22 extern "C" { 23 #include <lualib.h> 24 #include <lauxlib.h> 25 } 22 26 #include "utils/lua/luautils.h" 23 27 #include "utils/logging/logging.h" … … 189 193 190 194 lua_pushstring(pLuaState, VAR_MONTH); 191 lua_pushnumber(pLuaState, tempTm.tm_mon +1);195 lua_pushnumber(pLuaState, tempTm.tm_mon + 1); 192 196 lua_settable(pLuaState, -3); 193 197 … … 197 201 198 202 lua_pushstring(pLuaState, VAR_HOUR); 199 lua_pushnumber(pLuaState, tempTm.tm_hour );203 lua_pushnumber(pLuaState, tempTm.tm_hour + 1); 200 204 lua_settable(pLuaState, -3); 201 205 … … 230 234 231 235 lua_pushstring(pLuaState, VAR_MONTH); 232 lua_pushnumber(pLuaState, tempTm.tm_mon );236 lua_pushnumber(pLuaState, tempTm.tm_mon + 1); 233 237 lua_settable(pLuaState, -3); 234 238 … … 262 266 263 267 lua_pushstring(pLuaState, VAR_HOUR); 264 lua_pushnumber(pLuaState, tempTm.tm_hour );268 lua_pushnumber(pLuaState, tempTm.tm_hour + 1); 265 269 lua_settable(pLuaState, -3); 266 270 -
trunk/sources/common/src/utils/mempool/mempool.cpp
r722 r732 88 88 if (pResult == NULL) { 89 89 _created++; 90 return ::operator new(_size, std::nothrow);90 return ::operator new(_size, nothrow); 91 91 } else { 92 92 _pEntries = _pEntries->pNext; -
trunk/sources/common/src/utils/misc/file.cpp
r702 r732 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 45 45 case FILE_OPEN_MODE_READ: 46 46 { 47 openMode = "r ";47 openMode = "rb"; 48 48 break; 49 49 } 50 50 case FILE_OPEN_MODE_TRUNCATE: 51 51 { 52 openMode = "w+ ";52 openMode = "w+b"; 53 53 break; 54 54 } 55 55 case FILE_OPEN_MODE_APPEND: 56 56 { 57 openMode = "a+ ";57 openMode = "a+b"; 58 58 break; 59 59 } -
trunk/sources/common/src/utils/misc/timersmanager.cpp
r413 r732 28 28 _pSlots = NULL; 29 29 _slotsCount = 0; 30 #ifdef NET_IOCP 31 _inExecution=false; 32 #endif 30 33 } 31 34 … … 35 38 } 36 39 40 #ifdef NET_IOCP 41 void TimersManager::RemoveTimer(uint32_t eventTimerId) { 42 for (uint32_t i = 0; i < _slotsCount; i++) { 43 if (MAP_HAS1(_pSlots[i].timers, eventTimerId)) { 44 if(_inExecution){ 45 _pSlots[i].timers[eventTimerId].pUserData=NULL; 46 ADD_VECTOR_END(_pendingForRemoval,eventTimerId); 47 } else { 48 _pSlots[i].timers.erase(eventTimerId); 49 } 50 } 51 } 52 } 53 #else 37 54 void TimersManager::RemoveTimer(uint32_t eventTimerId) { 38 55 for (uint32_t i = 0; i < _slotsCount; i++) { … … 42 59 } 43 60 } 61 #endif 44 62 45 63 void TimersManager::AddTimer(TimerEvent& timerEvent) { … … 59 77 } 60 78 79 #ifdef NET_IOCP 80 void TimersManager::TimeElapsed(uint64_t currentTime) { 81 _inExecution=true; 82 int64_t delta = currentTime - _lastTime; 83 _lastTime = currentTime; 84 85 if (delta <= 0 || _slotsCount == 0){ 86 _inExecution=false; 87 return; 88 } 89 90 for (int32_t i = 0; i < delta; i++) { 91 92 FOR_MAP(_pSlots[_currentSlotIndex % _slotsCount].timers, uint32_t, TimerEvent, j) { 93 _processTimerEvent(MAP_VAL(j)); 94 } 95 _currentSlotIndex++; 96 } 97 _inExecution=false; 98 for(uint32_t i=0;i<_pendingForRemoval.size();i++) { 99 RemoveTimer(_pendingForRemoval[i]); 100 } 101 _pendingForRemoval.clear(); 102 } 103 #else 61 104 void TimersManager::TimeElapsed(uint64_t currentTime) { 62 105 int64_t delta = currentTime - _lastTime; … … 74 117 } 75 118 } 119 #endif 76 120 77 121 void TimersManager::UpdatePeriods(uint32_t period) { … … 109 153 return 0; 110 154 uint32_t result = a * b / GCD(a, b); 111 FINEST("a: %u; b: %u; r: %u", a, b, result);155 //FINEST("a: %u; b: %u; r: %u", a, b, result); 112 156 return result; 113 157 } -
trunk/sources/common/src/utils/misc/uri.cpp
r730 r732 102 102 bool hasAuthentication = false; 103 103 pos = stringUri.find("@", cursor); 104 if (pos != string::npos && pos < limit) {104 if (pos != string::npos) { 105 105 if (limit != string::npos) { 106 106 hasAuthentication = pos<limit; 107 } 108 hasAuthentication = true; 107 } else { 108 hasAuthentication = true; 109 } 109 110 } 110 111 if (hasAuthentication) { -
trunk/sources/common/src/utils/misc/variant.cpp
r722 r732 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 1062 1062 1063 1063 if (detectedType == V_TIME || detectedType == V_TIMESTAMP) { 1064 temp.tm_hour = (int) ((int32_t) (*this)["hour"]) ;1064 temp.tm_hour = (int) ((int32_t) (*this)["hour"]) - 1; 1065 1065 temp.tm_min = (int) ((int32_t) (*this)["min"]); 1066 1066 temp.tm_sec = (int) (HasKey("sec") ? … … 1656 1656 } 1657 1657 1658 bool Variant::DeserializeFromCmdLineArgs(uint32_t count, c har **pArguments,1658 bool Variant::DeserializeFromCmdLineArgs(uint32_t count, const char **pArguments, 1659 1659 Variant &result) { 1660 1660 if (count < 1) { … … 1904 1904 { 1905 1905 VARIANT_CHECK_BOUNDS(4); 1906 variant = ENTOHLP(PTR); //----MARKED-LONG---1906 variant = (uint32_t) ENTOHLP(PTR); //----MARKED-LONG--- 1907 1907 cursor += 4; 1908 1908 return true;
Note: See TracChangeset
for help on using the changeset viewer.
