Make many more utility classes/headers public. (#76)

Moving these headers from src to include enables other libraries to use the
functionality provided.

* tcpsockets
* atomic_static
* raw_istream
* timestamp
* SafeThread
* Base64
* LEB128
* ConcurrentQueue

The classes have been moved into the wpi namespace as they're generic.
This commit is contained in:
Peter Johnson
2016-07-27 00:39:38 -07:00
committed by GitHub
parent d66f65e376
commit a73166a665
47 changed files with 361 additions and 259 deletions

View File

@@ -21,7 +21,7 @@
limitations under the License.
*/
#include "TCPStream.h"
#include "tcpsockets/TCPStream.h"
#ifdef _WIN32
#include <WinSock2.h>
@@ -31,13 +31,15 @@
#include <unistd.h>
#endif
TCPStream::TCPStream(int sd, struct sockaddr_in* address) : m_sd(sd) {
using namespace wpi;
TCPStream::TCPStream(int sd, sockaddr_in* address) : m_sd(sd) {
char ip[50];
#ifdef _WIN32
unsigned long size = sizeof(ip) - 1;
WSAAddressToString((struct sockaddr*)address, sizeof sockaddr_in, nullptr, ip, &size);
WSAAddressToString((sockaddr*)address, sizeof sockaddr_in, nullptr, ip, &size);
#else
inet_ntop(PF_INET, (struct in_addr*)&(address->sin_addr.s_addr), ip,
inet_ntop(PF_INET, (in_addr*)&(address->sin_addr.s_addr), ip,
sizeof(ip) - 1);
#endif
m_peerIP = ip;