C++ Sockets Library documentation

C++ Sockets Library

Name of changed file

Version and , fileVersion and , file
Line 1 in Line 1 in
Context line
Removed line
Changed line
Context line
Context line
Changed line
Added line
Context line

Changelog

/usr/src/Sockets-2.3.9.7/Changelog 2011-08-16 19:32:09.0, 0200/usr/src/Sockets-2.3.9.8/Changelog 2013-04-10 19:45:55.0, 0200
Line 1 in ChangelogLine 1 in Changelog
diff for next release always available @ http://www.alhem.net/Sockets/latest_diff.html
2.3.9.8
--------
Fix multiple include file problems on macosx, win32, and gcc 4.7.
Add support for user/pw in HTTPSocket and Utility url parser.
Switch to clang with environment variable 'USE_CLANG=with_clang'.
Add support for certificate chains in tcp socket.
UdpSocket bugfix, uninitialized variable.
Remove extra namespace 'Xml' from libxml2 wrapper classes.
2.3.9.7
--------

HttpRequest.cpp

/usr/src/Sockets-2.3.9.7/HttpRequest.cpp 2011-07-17 10:06:09.0, 0200/usr/src/Sockets-2.3.9.8/HttpRequest.cpp 2012-09-05 10:40:33.0, 0200
Line 40 in HttpRequest.cppLine 40 in HttpRequest.cpp
#include "Parse.h"
#include "Exception.h"
#ifdef MACOSX
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#endif
#ifdef SOCKETS_NAMESPACE

HTTPSocket.cpp

/usr/src/Sockets-2.3.9.7/HTTPSocket.cpp 2011-07-17 10:06:12.0, 0200/usr/src/Sockets-2.3.9.8/HTTPSocket.cpp 2011-09-30 20:26:08.0, 0200
Line 459 in HTTPSocket.cppLine 459 in HTTPSocket.cpp
{
Parse pa(url_in,"/");
std::string user;
std::string auth;
protocol = pa.getword(); // http
if (!strcasecmp(protocol.c_str(), "https:"))
Line 474 in HTTPSocket.cppLine 476 in HTTPSocket.cpp
}
host = pa.getword();
size_t pos = host.find("@");
if (pos != std::string::npos)
{
user = host.substr(0, pos);
host = host.substr(pos + 1);
if (user.find(":") != std::string::npos)
{
AddResponseHeader("Authorization", "Basic " + Utility::base64(user));
}
}
if (strstr(host.c_str(),":"))
{

Makefile

/usr/src/Sockets-2.3.9.7/Makefile 2011-07-15 21:55:15.0, 0200/usr/src/Sockets-2.3.9.8/Makefile 2013-04-10 19:52:39.0, 0200
Line 56 in MakefileLine 56 in Makefile
PROGS = $(CONFNAME)
all: $(LIBNAME) $(PROGS) pc
shared: $(SHAREDLIBNAME)
$(LIBNAME): $(OBJS)
ar cru $@ $^
ranlib $@
$(SHAREDLIBNAME): $(OBJS)
$(CXX) $(LDFLAGSSO) -o $@ $^
$(CONFNAME): Sockets-config.o
$(CXX) $(LDFLAGS) -o $@ $^
pc:
PROGS = $(CONFNAME)
all: $(LIBNAME) $(PROGS) pc shared
shared: $(SHAREDLIBNAME)
$(LIBNAME): $(OBJS)
@echo Creating $@
@ar cru $@ $^
@ranlib $@
$(SHAREDLIBNAME): $(OBJS)
@echo Creating $@
@$(CXX) $(LDFLAGSSO) -o $@ $^
$(CONFNAME): Sockets-config.o
@echo Creating $@
@$(CXX) $(LDFLAGS) -o $@ $^
pc:
Line 141 in MakefileLine 144 in Makefile
rm -f Min*Socket.* Min*Handler.*
rm -f Uid.*
rm -f Session.*
tar czf Sockets-$(VERSION).tar.gz $(FILES)
/usr/local/bin/tarfix.sh Sockets-$(VERSION)
Line 157 in MakefileLine 161 in Makefile
rm -f Min*Socket.* Min*Handler.*
rm -f Uid.*
rm -f Session.*
tar czf Sockets-$(VERSION).tar.gz $(FILES)
/usr/local/bin/tarfix.sh Sockets-$(VERSION)
Line 175 in MakefileLine 180 in Makefile
rm -f Uid.*
rm -f tests/*.cpp
rm -f Session.*
./mkdot.sh
rm -rf /usr/local/apache/www.alhem.net/htdocs/Sockets/html
Line 192 in MakefileLine 198 in Makefile
rm -f Uid.*
rm -f tests/*.cpp
rm -f Session.*
./mkdot-tmp.sh
rm -rf /usr/local/apache/www.alhem.net/htdocs/Sockets-tmp/html
doxygen doxygen-tmp.cfg
svn up
deb:
@$(MAKE) -C debian
@$(MAKE) -C debian-lib-dev
publish:
@$(MAKE) -C debian publish
@$(MAKE) -C debian-lib-dev publish

Makefile.Defines.linux-x86-32

/usr/src/Sockets-2.3.9.7/Makefile.Defines.linux-x86-32 2010-02-06 20:02:11.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.linux-x86-32 2013-03-13 15:13:31.0, 0100
Line 1 in Makefile.Defines.linux-x86-32Line 1 in Makefile.Defines.linux-x86-32
ifeq ($(USE_CLANG),with_clang)
CXX = clang++
else
CXX = g++
endif
CFLAGS += -Wall -g $(INCLUDE) -MD -D_VERSION='"$(VERSION)"'
Line 26 in Makefile.Defines.linux-x86-32Line 30 in Makefile.Defines.linux-x86-32
-Wl,-call_shared
.cpp.o:
@echo [$(CXX)] Compiling $<
$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.Defines.linux-x86-64

/usr/src/Sockets-2.3.9.7/Makefile.Defines.linux-x86-64 2010-02-21 09:40:49.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.linux-x86-64 2013-03-13 15:10:38.0, 0100
Line 1 in Makefile.Defines.linux-x86-64Line 1 in Makefile.Defines.linux-x86-64
ifeq ($(USE_CLANG),with_clang)
CXX = clang++
else
CXX = g++
endif
CFLAGS += -Wall -g $(INCLUDE) -MD -D_VERSION='"$(VERSION)"'
Line 26 in Makefile.Defines.linux-x86-64Line 30 in Makefile.Defines.linux-x86-64
-Wl,-call_shared
.cpp.o:
@echo [$(CXX)] Compiling $<
@$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.Defines.macosx

/usr/src/Sockets-2.3.9.7/Makefile.Defines.macosx 2010-02-06 20:02:11.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.macosx 2013-03-13 15:10:41.0, 0100
Line 1 in Makefile.Defines.macosxLine 1 in Makefile.Defines.macosx
ifeq ($(USE_CLANG),with_clang)
CXX = clang++
else
CXX = g++
endif
CFLAGS += -Wall -g $(INCLUDE) -MD -D_VERSION='"$(VERSION)"'
Line 18 in Makefile.Defines.macosxLine 22 in Makefile.Defines.macosx
OBJS += Semaphore.o
LDFLAGSSO = -shared \
-Wl,-lssl \
-Wl,-lcrypto \
-Wl,-lxml2 \
-Wl,-lpthread
.cpp.o:
@echo [$(CXX)] Compiling $<
@$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.Defines.solaris8

/usr/src/Sockets-2.3.9.7/Makefile.Defines.solaris8 2010-02-06 20:02:11.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.solaris8 2013-03-13 15:10:43.0, 0100
Line 19 in Makefile.Defines.solaris8Line 19 in Makefile.Defines.solaris8
OBJS += Semaphore.o
.cpp.o:
@echo [$(CXX)] Compiling $<
@$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.Defines.solaris9-sparc-64

/usr/src/Sockets-2.3.9.7/Makefile.Defines.solaris9-sparc-64 2010-02-06 20:02:11.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.solaris9-sparc-64 2013-03-13 15:10:46.0, 0100
Line 19 in Makefile.Defines.solaris9-sparc-64Line 19 in Makefile.Defines.solaris9-sparc-64
OBJS += Semaphore.o
.cpp.o:
@echo [$(CXX)] Compiling $<
@$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.Defines.win32-cygwin

/usr/src/Sockets-2.3.9.7/Makefile.Defines.win32-cygwin 2010-02-06 20:02:11.0, 0100/usr/src/Sockets-2.3.9.8/Makefile.Defines.win32-cygwin 2013-03-13 15:10:48.0, 0100
Line 17 in Makefile.Defines.win32-cygwinLine 17 in Makefile.Defines.win32-cygwin
-lws2_32
.cpp.o:
@echo [$(CXX)] Compiling $<
@$(CXX) $(CFLAGS) -o $@ -c $<

Makefile.version

/usr/src/Sockets-2.3.9.7/Makefile.version 2011-08-16 12:06:18.0, 0200/usr/src/Sockets-2.3.9.8/Makefile.version 2013-04-10 19:51:21.0, 0200
Line 1 in Makefile.versionLine 1 in Makefile.version
MAJOR = 2
MINOR = 3.9.7
VERSION = $(MAJOR).$(MINOR)
DIFF_VERSION = 2.3.9.6
# Sockets
OBJS = \
Ajp13Socket.o \
AjpBaseSocket.o \
Base64.o \
Debug.o \
Event.o \
EventHandler.o \
EventTime.o \
Exception.o \
File.o \
FileStream.o \
HTTPSocket.o \
HttpBaseSocket.o \
HttpClientSocket.o \
HttpDebugSocket.o \
HttpGetSocket.o \
HttpPostSocket.o \
HttpPutSocket.o \
HttpRequest.o \
HttpResponse.o \
HttpTransaction.o \
HttpdCookies.o \
HttpdForm.o \
HttpdSocket.o \
IEventOwner.o \
Ipv4Address.o \
Ipv6Address.o \
Json.o \
Lock.o \
MemFile.o \
Mutex.o \
Parse.o \
ResolvServer.o \
ResolvSocket.o \
SSLInitializer.o \
SctpSocket.o \
SmtpdSocket.o \
Socket.o \
SocketHandler.o \
SocketHandlerEp.o \
SocketHandlerThread.o \
SocketStream.o \
SocketThread.o \
StdoutLog.o \
StreamSocket.o \
StreamWriter.o \
TcpSocket.o \
Thread.o \
UdpSocket.o \
Utility.o \
XmlDocument.o \
XmlNode.o \
XmlException.o
MAJOR = 2
MINOR = 3.9.8
VERSION = $(MAJOR).$(MINOR)
DIFF_VERSION = 2.3.9.7
DEBIAN_REV = 1
# Sockets
SRCS = Ajp13Socket.cpp \
AjpBaseSocket.cpp \
Base64.cpp \
Debug.cpp \
Event.cpp \
EventHandler.cpp \
EventTime.cpp \
Exception.cpp \
File.cpp \
FileStream.cpp \
HTTPSocket.cpp \
HttpBaseSocket.cpp \
HttpClientSocket.cpp \
HttpDebugSocket.cpp \
HttpGetSocket.cpp \
HttpPostSocket.cpp \
HttpPutSocket.cpp \
HttpRequest.cpp \
HttpResponse.cpp \
HttpTransaction.cpp \
HttpdCookies.cpp \
HttpdForm.cpp \
HttpdSocket.cpp \
IEventOwner.cpp \
Ipv4Address.cpp \
Ipv6Address.cpp \
Json.cpp \
Lock.cpp \
MemFile.cpp \
Mutex.cpp \
Parse.cpp \
ResolvServer.cpp \
ResolvSocket.cpp \
SSLInitializer.cpp \
SctpSocket.cpp \
SmtpdSocket.cpp \
Socket.cpp \
SocketHandler.cpp \
SocketHandlerEp.cpp \
SocketHandlerThread.cpp \
SocketStream.cpp \
SocketThread.cpp \
StdoutLog.cpp \
StreamSocket.cpp \
StreamWriter.cpp \
TcpSocket.cpp \
Thread.cpp \
UdpSocket.cpp \
Utility.cpp \
XmlDocument.cpp \
XmlNode.cpp \
XmlException.cpp
OBJS = $(patsubst %.cpp, %.o, $(SRCS))

SctpSocket.cpp

/usr/src/Sockets-2.3.9.7/SctpSocket.cpp 2011-07-17 10:06:33.0, 0200/usr/src/Sockets-2.3.9.8/SctpSocket.cpp 2012-09-08 18:58:15.0, 0200
Line 267 in SctpSocket.cppLine 267 in SctpSocket.cpp
return -1;
}
int n = sctp_connectx(GetSocket(), ad, ad);
if (n == -1)
{
return -1;
}
// int n = sctp_connectx(GetSocket(), ad, ad);
int n = sctp_connectx(GetSocket(), ad, 1, NULL);
if (n == -1)
{

Socket.h

/usr/src/Sockets-2.3.9.7/Socket.h 2011-07-17 10:04:10.0, 0200/usr/src/Sockets-2.3.9.8/Socket.h 2012-09-08 08:44:49.0, 0200
Line 37 in Socket.hLine 37 in Socket.h
#include <vector>
#include <list>
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#endif
#include "socket_include.h"
#include <time.h>
#include "SocketAddress.h"
#include <vector>
#include <list>
#include "socket_include.h"
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#endif
#include <time.h>
#include "SocketAddress.h"

socket_include.h

/usr/src/Sockets-2.3.9.7/socket_include.h 2011-07-17 10:04:21.0, 0200/usr/src/Sockets-2.3.9.8/socket_include.h 2012-09-05 10:37:44.0, 0200
Line 78 in socket_include.hLine 78 in socket_include.h
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
// all typedefs in this file will be declared outside the sockets namespace,

Sockets-config.cpp

/usr/src/Sockets-2.3.9.7/Sockets-config.cpp 2011-07-11 16:25:48.0, 0200/usr/src/Sockets-2.3.9.8/Sockets-config.cpp 2013-03-13 15:18:45.0, 0100
Line 24 in Sockets-config.cppLine 24 in Sockets-config.cpp
#include <string.h>
#include "sockets-config.h"
#include "socket_include.h"
#include <map>
#include <string>
// ------------------------------------------------------------------
static bool any_set = false;
static std::map<std::string, std::string> mmap;
// ------------------------------------------------------------------
#include <string.h>
#include "sockets-config.h"
//#include "socket_include.h"
#include <map>
#include <string>
#include <cstdlib>
// ------------------------------------------------------------------
static bool any_set = false;
static std::map<std::string, std::string> mmap;
static bool quiet = false;
// ------------------------------------------------------------------
Line 171 in Sockets-config.cppLine 173 in Sockets-config.cpp
fclose(fil);
fclose(fil2);
#ifdef _WIN32
unlink("sockets-config.h");
#endif
rename("sockets-config.h.tmp", "sockets-config.h");
any_set = true;
Line 387 in Sockets-config.cppLine 392 in Sockets-config.cpp
any_set = true;
else
if (!strcmp(argv[i], "-q"))
quiet = true;
else
if (*argv[i] == '-')
{
Line 402 in Sockets-config.cppLine 410 in Sockets-config.cpp
fprintf(stderr, " -info Show compiled options\n");
fprintf(stderr, " -v Show configuration options\n");
fprintf(stderr, " -q Don't show extra info\n");
fprintf(stderr, " -h Show this help\n");
fprintf(stderr, "\n");
Line 442 in Sockets-config.cppLine 451 in Sockets-config.cpp
if (any_set)
{
if (!quiet)
show_configuration();
return 0;

TcpSocket.cpp

/usr/src/Sockets-2.3.9.7/TcpSocket.cpp 2011-07-17 10:06:58.0, 0200/usr/src/Sockets-2.3.9.8/TcpSocket.cpp 2012-09-08 08:47:13.0, 0200
Line 48 in TcpSocket.cppLine 48 in TcpSocket.cpp
#include <map>
#include <stdio.h>
#ifndef _WIN32
#include <netinet/tcp.h>
#endif
#include "TcpSocket.h"
Line 1294 in TcpSocket.cppLine 1297 in TcpSocket.cpp
void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,const SSL_METHOD *meth_in)
{
Lock lock(m_server_ssl_mutex);
/* Create our context*/
if (m_server_contexts.find(context) == m_server_contexts.end())
{
void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,const SSL_METHOD *meth_in)
{
InitializeContext(context, keyfile, keyfile, password, meth_in);
/*
Lock lock(m_server_ssl_mutex);
// Create our context
if (m_server_contexts.find(context) == m_server_contexts.end())
{
Line 1312 in TcpSocket.cppLine 1317 in TcpSocket.cpp
}
/* Load our keys and certificates*/
if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM)))
{
}
// Load our keys and certificates
if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM)))
{
Line 1325 in TcpSocket.cppLine 1330 in TcpSocket.cpp
Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL);
}
*/
}
Line 1364 in TcpSocket.cppLine 1370 in TcpSocket.cpp
void TcpSocket::UseCertificateChainFile(const std::string& filename)
{
if (!(SSL_CTX_use_certificate_chain_file(m_ssl_ctx, filename.c_str())))
{
Handler().LogError(this, "TcpSocket UseCertificateChainFile", 0, "Couldn't read certificate file " + filename, LOG_LEVEL_ERROR);
}
}
int TcpSocket::SSL_password_cb(char *buf,int num,int rwflag,void *userdata)
{

TcpSocket.h

/usr/src/Sockets-2.3.9.7/TcpSocket.h 2011-07-17 10:04:33.0, 0200/usr/src/Sockets-2.3.9.8/TcpSocket.h 2012-07-25 10:32:38.0, 0200
Line 286 in TcpSocket.hLine 286 in TcpSocket.h
\param meth_in SSL method */
void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, const SSL_METHOD *meth_in = NULL);
/** SSL; load certificate chain from file */
void UseCertificateChainFile(const std::string& filename);
/** SSL; Password callback method. */
static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata);

UdpSocket.cpp

/usr/src/Sockets-2.3.9.7/UdpSocket.cpp 2011-07-17 10:07:02.0, 0200/usr/src/Sockets-2.3.9.8/UdpSocket.cpp 2013-03-17 10:38:36.0, 0100
Line 606 in UdpSocket.cppLine 606 in UdpSocket.cpp
{
int is_broadcast = 0;
socklen_t size;
if (GetSocket() == INVALID_SOCKET)
{
int is_broadcast = 0;
socklen_t size = sizeof(int);
if (GetSocket() == INVALID_SOCKET)

Utility.cpp

/usr/src/Sockets-2.3.9.7/Utility.cpp 2011-07-17 10:07:05.0, 0200/usr/src/Sockets-2.3.9.8/Utility.cpp 2011-09-23 16:30:45.0, 0200
Line 1188 in Utility.cppLine 1188 in Utility.cpp
m_host = m_host.substr(0, pos);
}
pos = m_host.find("@");
if (pos != std::string::npos)
{
m_user = m_host.substr(0, pos);
m_host = m_host.substr(pos + 1);
}
pos = m_user.find(":");
if (pos != std::string::npos)
{
m_auth = m_user.substr(pos + 1);
m_user = m_user.substr(0, pos);
}
pos = m_host.find(":");
if (pos != std::string::npos)

Utility.h

/usr/src/Sockets-2.3.9.7/Utility.h 2011-07-17 10:04:41.0, 0200/usr/src/Sockets-2.3.9.8/Utility.h 2011-09-23 16:20:13.0, 0200
Line 92 in Utility.hLine 92 in Utility.h
const std::string& ToString() const { return m_url; }
const std::string& User() const { return m_user; }
const std::string& Auth() const { return m_auth; }
private:
std::string m_url;
Line 102 in Utility.hLine 105 in Utility.h
std::string m_file;
std::string m_ext;
std::string m_user;
std::string m_auth;
};
class Path

XmlDocument.cpp

/usr/src/Sockets-2.3.9.7/XmlDocument.cpp 2011-07-17 10:07:07.0, 0200/usr/src/Sockets-2.3.9.8/XmlDocument.cpp 2012-07-25 10:32:38.0, 0200
Line 39 in XmlDocument.cppLine 39 in XmlDocument.cpp
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
Line 96 in XmlDocument.cppLine 95 in XmlDocument.cpp
}
#ifdef SOCKETS_NAMESPACE
}

XmlDocument.h

/usr/src/Sockets-2.3.9.7/XmlDocument.h 2011-07-17 10:04:43.0, 0200/usr/src/Sockets-2.3.9.8/XmlDocument.h 2012-07-25 10:32:38.0, 0200
Line 45 in XmlDocument.hLine 45 in XmlDocument.h
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
Line 70 in XmlDocument.hLine 69 in XmlDocument.h
}
#ifdef SOCKETS_NAMESPACE
}

XmlException.cpp

/usr/src/Sockets-2.3.9.7/XmlException.cpp 2011-07-17 10:07:08.0, 0200/usr/src/Sockets-2.3.9.8/XmlException.cpp 2012-07-25 10:32:38.0, 0200
Line 37 in XmlException.cppLine 37 in XmlException.cpp
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
Line 46 in XmlException.cppLine 45 in XmlException.cpp
}
#ifdef SOCKETS_NAMESPACE
}

XmlException.h

/usr/src/Sockets-2.3.9.7/XmlException.h 2011-07-17 10:04:44.0, 0200/usr/src/Sockets-2.3.9.8/XmlException.h 2012-07-25 10:32:38.0, 0200
Line 41 in XmlException.hLine 41 in XmlException.h
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
Line 57 in XmlException.hLine 56 in XmlException.h
}
#ifdef SOCKETS_NAMESPACE
}

XmlNode.cpp

/usr/src/Sockets-2.3.9.7/XmlNode.cpp 2011-07-17 10:07:10.0, 0200/usr/src/Sockets-2.3.9.8/XmlNode.cpp 2012-07-25 10:32:38.0, 0200
Line 41 in XmlNode.cppLine 41 in XmlNode.cpp
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
Line 350 in XmlNode.cppLine 349 in XmlNode.cpp
}
#ifdef SOCKETS_NAMESPACE
}

XmlNode.h

/usr/src/Sockets-2.3.9.7/XmlNode.h 2011-07-17 10:04:46.0, 0200/usr/src/Sockets-2.3.9.8/XmlNode.h 2012-07-25 10:32:38.0, 0200
Line 46 in XmlNode.hLine 46 in XmlNode.h
namespace SOCKETS_NAMESPACE {
#endif
namespace Xml {
class XmlDocument;
Line 142 in XmlNode.hLine 141 in XmlNode.h
}
#ifdef SOCKETS_NAMESPACE
}
Page, code, and content Copyright (C) 2013 by Anders Hedström