submitted 1.2.0

This commit is contained in:
Guenter Obiltschnig
2006-08-29 07:10:35 +00:00
parent f476bd6b32
commit 2d4078f392
1428 changed files with 25715 additions and 12456 deletions

View File

@@ -1,13 +1,15 @@
#
# Makefile
#
# $Id: //poco/1.1.0/Net/Makefile#1 $
# $Id: //poco/1.2/Net/Makefile#1 $
#
# Makefile for Poco Net
#
include $(POCO_BASE)/build/rules/global
SHAREDOPT_CXX += -DNet_EXPORTS
objects = \
DNS HTTPResponse HostEntry Socket \
DatagramSocket HTTPServer IPAddress SocketAddress \
@@ -18,16 +20,18 @@ objects = \
HTTPFixedLengthStream HTTPServerRequest MultipartWriter StreamSocketImpl \
HTTPHeaderStream HTTPServerResponse NameValueCollection TCPServer \
HTTPMessage HTTPServerSession NetException TCPServerConnection HTTPBufferAllocator \
HTTPRequest HTTPSession NetworkInterface TCPServerConnectionFactory \
HTTPRequest HTTPSession HTTPSessionInstantiator HTTPSessionFactory NetworkInterface TCPServerConnectionFactory \
HTTPRequestHandler HTTPStream HTTPIOStream ServerSocket TCPServerDispatcher \
HTTPRequestHandlerFactory HTTPStreamFactory ServerSocketImpl TCPServerParams \
QuotedPrintableEncoder QuotedPrintableDecoder StringPartSource \
FTPClientSession FTPStreamFactory PartHandler PartSource NullPartHandler \
SocketReactor SocketNotifier SocketNotification \
MailRecipient MailMessage MailStream SMTPClientSession POP3ClientSession
MailRecipient MailMessage MailStream SMTPClientSession POP3ClientSession \
RawSocket RawSocketImpl ICMPClient ICMPEventArgs ICMPPacket ICMPPacketImpl \
ICMPSocket ICMPSocketImpl ICMPv4PacketImpl
target = PocoNet
target_version = 1
target_version = $(LIBVERSION)
target_libs = PocoFoundation
include $(POCO_BASE)/build/rules/lib

View File

@@ -1,7 +1,7 @@
#
# Net.vmsbuild
#
# $Id: //poco/1.1.0/Net/Net.vmsbuild#1 $
# $Id: //poco/1.2/Net/Net.vmsbuild#1 $
#
LIB=PocoNet
<SourceFilesHere>

View File

@@ -149,25 +149,25 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\DNS.h">
RelativePath=".\include\Poco\Net\DNS.h">
</File>
<File
RelativePath=".\include\Net\HostEntry.h">
RelativePath=".\include\Poco\Net\HostEntry.h">
</File>
<File
RelativePath=".\include\Net\IPAddress.h">
RelativePath=".\include\Poco\Net\IPAddress.h">
</File>
<File
RelativePath=".\include\Net\Net.h">
RelativePath=".\include\Poco\Net\Net.h">
</File>
<File
RelativePath=".\include\Net\NetException.h">
RelativePath=".\include\Poco\Net\NetException.h">
</File>
<File
RelativePath=".\include\Net\SocketAddress.h">
RelativePath=".\include\Poco\Net\SocketAddress.h">
</File>
<File
RelativePath=".\include\Net\SocketDefs.h">
RelativePath=".\include\Poco\Net\SocketDefs.h">
</File>
</Filter>
<Filter
@@ -197,40 +197,46 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\DatagramSocket.h">
RelativePath=".\include\Poco\Net\DatagramSocket.h">
</File>
<File
RelativePath=".\include\Net\DatagramSocketImpl.h">
RelativePath=".\include\Poco\Net\DatagramSocketImpl.h">
</File>
<File
RelativePath=".\include\Net\DialogSocket.h">
RelativePath=".\include\Poco\Net\DialogSocket.h">
</File>
<File
RelativePath=".\include\Net\MulticastSocket.h">
RelativePath=".\include\Poco\Net\MulticastSocket.h">
</File>
<File
RelativePath=".\include\Net\NetworkInterface.h">
RelativePath=".\include\Poco\Net\NetworkInterface.h">
</File>
<File
RelativePath=".\include\Net\ServerSocket.h">
RelativePath=".\include\Poco\Net\RawSocket.h">
</File>
<File
RelativePath=".\include\Net\ServerSocketImpl.h">
RelativePath=".\include\Poco\Net\RawSocketImpl.h">
</File>
<File
RelativePath=".\include\Net\Socket.h">
RelativePath=".\include\Poco\Net\ServerSocket.h">
</File>
<File
RelativePath=".\include\Net\SocketImpl.h">
RelativePath=".\include\Poco\Net\ServerSocketImpl.h">
</File>
<File
RelativePath=".\include\Net\SocketStream.h">
RelativePath=".\include\Poco\Net\Socket.h">
</File>
<File
RelativePath=".\include\Net\StreamSocket.h">
RelativePath=".\include\Poco\Net\SocketImpl.h">
</File>
<File
RelativePath=".\include\Net\StreamSocketImpl.h">
RelativePath=".\include\Poco\Net\SocketStream.h">
</File>
<File
RelativePath=".\include\Poco\Net\StreamSocket.h">
</File>
<File
RelativePath=".\include\Poco\Net\StreamSocketImpl.h">
</File>
</Filter>
<Filter
@@ -251,6 +257,12 @@
<File
RelativePath=".\src\NetworkInterface.cpp">
</File>
<File
RelativePath=".\src\RawSocket.cpp">
</File>
<File
RelativePath=".\src\RawSocketImpl.cpp">
</File>
<File
RelativePath=".\src\ServerSocket.cpp">
</File>
@@ -281,40 +293,40 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\FilePartSource.h">
RelativePath=".\include\Poco\Net\FilePartSource.h">
</File>
<File
RelativePath=".\include\Net\MediaType.h">
RelativePath=".\include\Poco\Net\MediaType.h">
</File>
<File
RelativePath=".\include\Net\MessageHeader.h">
RelativePath=".\include\Poco\Net\MessageHeader.h">
</File>
<File
RelativePath=".\include\Net\MultipartReader.h">
RelativePath=".\include\Poco\Net\MultipartReader.h">
</File>
<File
RelativePath=".\include\Net\MultipartWriter.h">
RelativePath=".\include\Poco\Net\MultipartWriter.h">
</File>
<File
RelativePath=".\include\Net\NameValueCollection.h">
RelativePath=".\include\Poco\Net\NameValueCollection.h">
</File>
<File
RelativePath=".\include\Net\NullPartHandler.h">
RelativePath=".\include\Poco\Net\NullPartHandler.h">
</File>
<File
RelativePath=".\include\Net\PartHandler.h">
RelativePath=".\include\Poco\Net\PartHandler.h">
</File>
<File
RelativePath=".\include\Net\PartSource.h">
RelativePath=".\include\Poco\Net\PartSource.h">
</File>
<File
RelativePath=".\include\Net\QuotedPrintableDecoder.h">
RelativePath=".\include\Poco\Net\QuotedPrintableDecoder.h">
</File>
<File
RelativePath=".\include\Net\QuotedPrintableEncoder.h">
RelativePath=".\include\Poco\Net\QuotedPrintableEncoder.h">
</File>
<File
RelativePath=".\include\Net\StringPartSource.h">
RelativePath=".\include\Poco\Net\StringPartSource.h">
</File>
</Filter>
<Filter
@@ -365,40 +377,40 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\HTTPBasicCredentials.h">
RelativePath=".\include\Poco\Net\HTTPBasicCredentials.h">
</File>
<File
RelativePath=".\include\Net\HTTPBasicStreamBuf.h">
RelativePath=".\include\Poco\Net\HTTPBasicStreamBuf.h">
</File>
<File
RelativePath=".\include\Net\HTTPBufferAllocator.h">
RelativePath=".\include\Poco\Net\HTTPBufferAllocator.h">
</File>
<File
RelativePath=".\include\Net\HTTPChunkedStream.h">
RelativePath=".\include\Poco\Net\HTTPChunkedStream.h">
</File>
<File
RelativePath=".\include\Net\HTTPCookie.h">
RelativePath=".\include\Poco\Net\HTTPCookie.h">
</File>
<File
RelativePath=".\include\Net\HTTPFixedLengthStream.h">
RelativePath=".\include\Poco\Net\HTTPFixedLengthStream.h">
</File>
<File
RelativePath=".\include\Net\HTTPHeaderStream.h">
RelativePath=".\include\Poco\Net\HTTPHeaderStream.h">
</File>
<File
RelativePath=".\include\Net\HTTPMessage.h">
RelativePath=".\include\Poco\Net\HTTPMessage.h">
</File>
<File
RelativePath=".\include\Net\HTTPRequest.h">
RelativePath=".\include\Poco\Net\HTTPRequest.h">
</File>
<File
RelativePath=".\include\Net\HTTPResponse.h">
RelativePath=".\include\Poco\Net\HTTPResponse.h">
</File>
<File
RelativePath=".\include\Net\HTTPSession.h">
RelativePath=".\include\Poco\Net\HTTPSession.h">
</File>
<File
RelativePath=".\include\Net\HTTPStream.h">
RelativePath=".\include\Poco\Net\HTTPStream.h">
</File>
</Filter>
<Filter
@@ -446,19 +458,19 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\TCPServer.h">
RelativePath=".\include\Poco\Net\TCPServer.h">
</File>
<File
RelativePath=".\include\Net\TCPServerConnection.h">
RelativePath=".\include\Poco\Net\TCPServerConnection.h">
</File>
<File
RelativePath=".\include\Net\TCPServerConnectionFactory.h">
RelativePath=".\include\Poco\Net\TCPServerConnectionFactory.h">
</File>
<File
RelativePath=".\include\Net\TCPServerDispatcher.h">
RelativePath=".\include\Poco\Net\TCPServerDispatcher.h">
</File>
<File
RelativePath=".\include\Net\TCPServerParams.h">
RelativePath=".\include\Poco\Net\TCPServerParams.h">
</File>
</Filter>
<Filter
@@ -488,31 +500,31 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\HTTPRequestHandler.h">
RelativePath=".\include\Poco\Net\HTTPRequestHandler.h">
</File>
<File
RelativePath=".\include\Net\HTTPRequestHandlerFactory.h">
RelativePath=".\include\Poco\Net\HTTPRequestHandlerFactory.h">
</File>
<File
RelativePath=".\include\Net\HTTPServer.h">
RelativePath=".\include\Poco\Net\HTTPServer.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerConnection.h">
RelativePath=".\include\Poco\Net\HTTPServerConnection.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerConnectionFactory.h">
RelativePath=".\include\Poco\Net\HTTPServerConnectionFactory.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerParams.h">
RelativePath=".\include\Poco\Net\HTTPServerParams.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerRequest.h">
RelativePath=".\include\Poco\Net\HTTPServerRequest.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerResponse.h">
RelativePath=".\include\Poco\Net\HTTPServerResponse.h">
</File>
<File
RelativePath=".\include\Net\HTTPServerSession.h">
RelativePath=".\include\Poco\Net\HTTPServerSession.h">
</File>
</Filter>
<Filter
@@ -554,13 +566,19 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\HTTPClientSession.h">
RelativePath=".\include\Poco\Net\HTTPClientSession.h">
</File>
<File
RelativePath=".\include\Net\HTTPIOStream.h">
RelativePath=".\include\Poco\Net\HTTPIOStream.h">
</File>
<File
RelativePath=".\include\Net\HTTPStreamFactory.h">
RelativePath=".\include\Poco\Net\HTTPSessionFactory.h">
</File>
<File
RelativePath=".\include\Poco\Net\HTTPSessionInstantiator.h">
</File>
<File
RelativePath=".\include\Poco\Net\HTTPStreamFactory.h">
</File>
</Filter>
<Filter
@@ -572,6 +590,12 @@
<File
RelativePath=".\src\HTTPIOStream.cpp">
</File>
<File
RelativePath=".\src\HTTPSessionFactory.cpp">
</File>
<File
RelativePath=".\src\HTTPSessionInstantiator.cpp">
</File>
<File
RelativePath=".\src\HTTPStreamFactory.cpp">
</File>
@@ -584,7 +608,7 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\HTMLForm.h">
RelativePath=".\include\Poco\Net\HTMLForm.h">
</File>
</Filter>
<Filter
@@ -602,10 +626,10 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\FTPClientSession.h">
RelativePath=".\include\Poco\Net\FTPClientSession.h">
</File>
<File
RelativePath=".\include\Net\FTPStreamFactory.h">
RelativePath=".\include\Poco\Net\FTPStreamFactory.h">
</File>
</Filter>
<Filter
@@ -626,19 +650,19 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\SocketAcceptor.h">
RelativePath=".\include\Poco\Net\SocketAcceptor.h">
</File>
<File
RelativePath=".\include\Net\SocketConnector.h">
RelativePath=".\include\Poco\Net\SocketConnector.h">
</File>
<File
RelativePath=".\include\Net\SocketNotification.h">
RelativePath=".\include\Poco\Net\SocketNotification.h">
</File>
<File
RelativePath=".\include\Net\SocketNotifier.h">
RelativePath=".\include\Poco\Net\SocketNotifier.h">
</File>
<File
RelativePath=".\include\Net\SocketReactor.h">
RelativePath=".\include\Poco\Net\SocketReactor.h">
</File>
</Filter>
<Filter
@@ -662,19 +686,19 @@
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Net\MailMessage.h">
RelativePath=".\include\Poco\Net\MailMessage.h">
</File>
<File
RelativePath=".\include\Net\MailRecipient.h">
RelativePath=".\include\Poco\Net\MailRecipient.h">
</File>
<File
RelativePath=".\include\Net\MailStream.h">
RelativePath=".\include\Poco\Net\MailStream.h">
</File>
<File
RelativePath=".\include\Net\POP3ClientSession.h">
RelativePath=".\include\Poco\Net\POP3ClientSession.h">
</File>
<File
RelativePath=".\include\Net\SMTPClientSession.h">
RelativePath=".\include\Poco\Net\SMTPClientSession.h">
</File>
</Filter>
<Filter
@@ -697,6 +721,60 @@
</File>
</Filter>
</Filter>
<Filter
Name="ICMP"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\Net\ICMPClient.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPEventArgs.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPPacket.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPPacketImpl.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPSocket.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPSocketImpl.h">
</File>
<File
RelativePath=".\include\Poco\Net\ICMPv4PacketImpl.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\ICMPClient.cpp">
</File>
<File
RelativePath=".\src\ICMPEventArgs.cpp">
</File>
<File
RelativePath=".\src\ICMPPacket.cpp">
</File>
<File
RelativePath=".\src\ICMPPacketImpl.cpp">
</File>
<File
RelativePath=".\src\ICMPSocket.cpp">
</File>
<File
RelativePath=".\src\ICMPSocketImpl.cpp">
</File>
<File
RelativePath=".\src\ICMPv4PacketImpl.cpp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="Net"
ProjectGUID="{B057A1FE-09F7-465E-B8B5-E1B659051D76}"
RootNamespace="Net"
@@ -212,31 +212,31 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\DNS.h"
RelativePath=".\include\Poco\Net\DNS.h"
>
</File>
<File
RelativePath=".\include\Net\HostEntry.h"
RelativePath=".\include\Poco\Net\HostEntry.h"
>
</File>
<File
RelativePath=".\include\Net\IPAddress.h"
RelativePath=".\include\Poco\Net\IPAddress.h"
>
</File>
<File
RelativePath=".\include\Net\Net.h"
RelativePath=".\include\Poco\Net\Net.h"
>
</File>
<File
RelativePath=".\include\Net\NetException.h"
RelativePath=".\include\Poco\Net\NetException.h"
>
</File>
<File
RelativePath=".\include\Net\SocketAddress.h"
RelativePath=".\include\Poco\Net\SocketAddress.h"
>
</File>
<File
RelativePath=".\include\Net\SocketDefs.h"
RelativePath=".\include\Poco\Net\SocketDefs.h"
>
</File>
</Filter>
@@ -272,51 +272,59 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\DatagramSocket.h"
RelativePath=".\include\Poco\Net\DatagramSocket.h"
>
</File>
<File
RelativePath=".\include\Net\DatagramSocketImpl.h"
RelativePath=".\include\Poco\Net\DatagramSocketImpl.h"
>
</File>
<File
RelativePath=".\include\Net\DialogSocket.h"
RelativePath=".\include\Poco\Net\DialogSocket.h"
>
</File>
<File
RelativePath=".\include\Net\MulticastSocket.h"
RelativePath=".\include\Poco\Net\MulticastSocket.h"
>
</File>
<File
RelativePath=".\include\Net\NetworkInterface.h"
RelativePath=".\include\Poco\Net\NetworkInterface.h"
>
</File>
<File
RelativePath=".\include\Net\ServerSocket.h"
RelativePath=".\include\Poco\Net\RawSocket.h"
>
</File>
<File
RelativePath=".\include\Net\ServerSocketImpl.h"
RelativePath=".\include\Poco\Net\RawSocketImpl.h"
>
</File>
<File
RelativePath=".\include\Net\Socket.h"
RelativePath=".\include\Poco\Net\ServerSocket.h"
>
</File>
<File
RelativePath=".\include\Net\SocketImpl.h"
RelativePath=".\include\Poco\Net\ServerSocketImpl.h"
>
</File>
<File
RelativePath=".\include\Net\SocketStream.h"
RelativePath=".\include\Poco\Net\Socket.h"
>
</File>
<File
RelativePath=".\include\Net\StreamSocket.h"
RelativePath=".\include\Poco\Net\SocketImpl.h"
>
</File>
<File
RelativePath=".\include\Net\StreamSocketImpl.h"
RelativePath=".\include\Poco\Net\SocketStream.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\StreamSocket.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\StreamSocketImpl.h"
>
</File>
</Filter>
@@ -343,6 +351,14 @@
RelativePath=".\src\NetworkInterface.cpp"
>
</File>
<File
RelativePath=".\src\RawSocket.cpp"
>
</File>
<File
RelativePath=".\src\RawSocketImpl.cpp"
>
</File>
<File
RelativePath=".\src\ServerSocket.cpp"
>
@@ -380,51 +396,51 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\FilePartSource.h"
RelativePath=".\include\Poco\Net\FilePartSource.h"
>
</File>
<File
RelativePath=".\include\Net\MediaType.h"
RelativePath=".\include\Poco\Net\MediaType.h"
>
</File>
<File
RelativePath=".\include\Net\MessageHeader.h"
RelativePath=".\include\Poco\Net\MessageHeader.h"
>
</File>
<File
RelativePath=".\include\Net\MultipartReader.h"
RelativePath=".\include\Poco\Net\MultipartReader.h"
>
</File>
<File
RelativePath=".\include\Net\MultipartWriter.h"
RelativePath=".\include\Poco\Net\MultipartWriter.h"
>
</File>
<File
RelativePath=".\include\Net\NameValueCollection.h"
RelativePath=".\include\Poco\Net\NameValueCollection.h"
>
</File>
<File
RelativePath=".\include\Net\NullPartHandler.h"
RelativePath=".\include\Poco\Net\NullPartHandler.h"
>
</File>
<File
RelativePath=".\include\Net\PartHandler.h"
RelativePath=".\include\Poco\Net\PartHandler.h"
>
</File>
<File
RelativePath=".\include\Net\PartSource.h"
RelativePath=".\include\Poco\Net\PartSource.h"
>
</File>
<File
RelativePath=".\include\Net\QuotedPrintableDecoder.h"
RelativePath=".\include\Poco\Net\QuotedPrintableDecoder.h"
>
</File>
<File
RelativePath=".\include\Net\QuotedPrintableEncoder.h"
RelativePath=".\include\Poco\Net\QuotedPrintableEncoder.h"
>
</File>
<File
RelativePath=".\include\Net\StringPartSource.h"
RelativePath=".\include\Poco\Net\StringPartSource.h"
>
</File>
</Filter>
@@ -488,51 +504,51 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\HTTPBasicCredentials.h"
RelativePath=".\include\Poco\Net\HTTPBasicCredentials.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPBasicStreamBuf.h"
RelativePath=".\include\Poco\Net\HTTPBasicStreamBuf.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPBufferAllocator.h"
RelativePath=".\include\Poco\Net\HTTPBufferAllocator.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPChunkedStream.h"
RelativePath=".\include\Poco\Net\HTTPChunkedStream.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPCookie.h"
RelativePath=".\include\Poco\Net\HTTPCookie.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPFixedLengthStream.h"
RelativePath=".\include\Poco\Net\HTTPFixedLengthStream.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPHeaderStream.h"
RelativePath=".\include\Poco\Net\HTTPHeaderStream.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPMessage.h"
RelativePath=".\include\Poco\Net\HTTPMessage.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPRequest.h"
RelativePath=".\include\Poco\Net\HTTPRequest.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPResponse.h"
RelativePath=".\include\Poco\Net\HTTPResponse.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPSession.h"
RelativePath=".\include\Poco\Net\HTTPSession.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPStream.h"
RelativePath=".\include\Poco\Net\HTTPStream.h"
>
</File>
</Filter>
@@ -592,23 +608,23 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\TCPServer.h"
RelativePath=".\include\Poco\Net\TCPServer.h"
>
</File>
<File
RelativePath=".\include\Net\TCPServerConnection.h"
RelativePath=".\include\Poco\Net\TCPServerConnection.h"
>
</File>
<File
RelativePath=".\include\Net\TCPServerConnectionFactory.h"
RelativePath=".\include\Poco\Net\TCPServerConnectionFactory.h"
>
</File>
<File
RelativePath=".\include\Net\TCPServerDispatcher.h"
RelativePath=".\include\Poco\Net\TCPServerDispatcher.h"
>
</File>
<File
RelativePath=".\include\Net\TCPServerParams.h"
RelativePath=".\include\Poco\Net\TCPServerParams.h"
>
</File>
</Filter>
@@ -644,39 +660,39 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\HTTPRequestHandler.h"
RelativePath=".\include\Poco\Net\HTTPRequestHandler.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPRequestHandlerFactory.h"
RelativePath=".\include\Poco\Net\HTTPRequestHandlerFactory.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServer.h"
RelativePath=".\include\Poco\Net\HTTPServer.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerConnection.h"
RelativePath=".\include\Poco\Net\HTTPServerConnection.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerConnectionFactory.h"
RelativePath=".\include\Poco\Net\HTTPServerConnectionFactory.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerParams.h"
RelativePath=".\include\Poco\Net\HTTPServerParams.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerRequest.h"
RelativePath=".\include\Poco\Net\HTTPServerRequest.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerResponse.h"
RelativePath=".\include\Poco\Net\HTTPServerResponse.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPServerSession.h"
RelativePath=".\include\Poco\Net\HTTPServerSession.h"
>
</File>
</Filter>
@@ -728,15 +744,23 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\HTTPClientSession.h"
RelativePath=".\include\Poco\Net\HTTPClientSession.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPIOStream.h"
RelativePath=".\include\Poco\Net\HTTPIOStream.h"
>
</File>
<File
RelativePath=".\include\Net\HTTPStreamFactory.h"
RelativePath=".\include\Poco\Net\HTTPSessionFactory.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\HTTPSessionInstantiator.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\HTTPStreamFactory.h"
>
</File>
</Filter>
@@ -751,6 +775,14 @@
RelativePath=".\src\HTTPIOStream.cpp"
>
</File>
<File
RelativePath=".\src\HTTPSessionFactory.cpp"
>
</File>
<File
RelativePath=".\src\HTTPSessionInstantiator.cpp"
>
</File>
<File
RelativePath=".\src\HTTPStreamFactory.cpp"
>
@@ -764,7 +796,7 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\HTMLForm.h"
RelativePath=".\include\Poco\Net\HTMLForm.h"
>
</File>
</Filter>
@@ -784,11 +816,11 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\FTPClientSession.h"
RelativePath=".\include\Poco\Net\FTPClientSession.h"
>
</File>
<File
RelativePath=".\include\Net\FTPStreamFactory.h"
RelativePath=".\include\Poco\Net\FTPStreamFactory.h"
>
</File>
</Filter>
@@ -812,23 +844,23 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\SocketAcceptor.h"
RelativePath=".\include\Poco\Net\SocketAcceptor.h"
>
</File>
<File
RelativePath=".\include\Net\SocketConnector.h"
RelativePath=".\include\Poco\Net\SocketConnector.h"
>
</File>
<File
RelativePath=".\include\Net\SocketNotification.h"
RelativePath=".\include\Poco\Net\SocketNotification.h"
>
</File>
<File
RelativePath=".\include\Net\SocketNotifier.h"
RelativePath=".\include\Poco\Net\SocketNotifier.h"
>
</File>
<File
RelativePath=".\include\Net\SocketReactor.h"
RelativePath=".\include\Poco\Net\SocketReactor.h"
>
</File>
</Filter>
@@ -856,23 +888,23 @@
Name="Header Files"
>
<File
RelativePath=".\include\Net\MailMessage.h"
RelativePath=".\include\Poco\Net\MailMessage.h"
>
</File>
<File
RelativePath=".\include\Net\MailRecipient.h"
RelativePath=".\include\Poco\Net\MailRecipient.h"
>
</File>
<File
RelativePath=".\include\Net\MailStream.h"
RelativePath=".\include\Poco\Net\MailStream.h"
>
</File>
<File
RelativePath=".\include\Net\POP3ClientSession.h"
RelativePath=".\include\Poco\Net\POP3ClientSession.h"
>
</File>
<File
RelativePath=".\include\Net\SMTPClientSession.h"
RelativePath=".\include\Poco\Net\SMTPClientSession.h"
>
</File>
</Filter>
@@ -901,6 +933,74 @@
</File>
</Filter>
</Filter>
<Filter
Name="ICMP"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\Net\ICMPClient.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPEventArgs.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPPacket.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPPacketImpl.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPSocket.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPSocketImpl.h"
>
</File>
<File
RelativePath=".\include\Poco\Net\ICMPv4PacketImpl.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\ICMPClient.cpp"
>
</File>
<File
RelativePath=".\src\ICMPEventArgs.cpp"
>
</File>
<File
RelativePath=".\src\ICMPPacket.cpp"
>
</File>
<File
RelativePath=".\src\ICMPPacketImpl.cpp"
>
</File>
<File
RelativePath=".\src\ICMPSocket.cpp"
>
</File>
<File
RelativePath=".\src\ICMPSocketImpl.cpp"
>
</File>
<File
RelativePath=".\src\ICMPv4PacketImpl.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

View File

@@ -1,7 +1,7 @@
//
// DNS.h
//
// $Id: //poco/1.1.0/Net/include/Net/DNS.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/DNS.h#1 $
//
// Library: Net
// Package: NetCore
@@ -40,28 +40,16 @@
#define Net_DNS_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketDefs_INCLUDED
#include "Net/SocketDefs.h"
#endif
#ifndef Net_IPAddress_INCLUDED
#include "Net/IPAddress.h"
#endif
#ifndef Net_HostEntry_INCLUDED
#include "Net/HostEntry.h"
#endif
#ifndef Foundation_Mutex_INCLUDED
#include "Foundation/Mutex.h"
#endif
#ifndef STD_MAP_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/IPAddress.h"
#include "Poco/Net/HostEntry.h"
#include "Poco/Mutex.h"
#include <map>
#define STD_MAP_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API DNS
@@ -142,11 +130,11 @@ private:
typedef std::map<std::string, HostEntry> DNSCache;
static DNSCache _cache;
static Foundation::FastMutex _mutex;
static Poco::FastMutex _mutex;
};
Net_END
} } // namespace Poco::Net
#endif // Net_DNS_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// DatagramSocket.h
//
// $Id: //poco/1.1.0/Net/include/Net/DatagramSocket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/DatagramSocket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_DatagramSocket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API DatagramSocket: public Socket
@@ -166,7 +163,7 @@ inline bool DatagramSocket::getBroadcast() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_DatagramSocket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// DatagramSocketImpl.h
//
// $Id: //poco/1.1.0/Net/include/Net/DatagramSocketImpl.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/DatagramSocketImpl.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_DatagramSocketImpl_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketImpl_INCLUDED
#include "Net/SocketImpl.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketImpl.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API DatagramSocketImpl: public SocketImpl
@@ -78,7 +75,7 @@ protected:
};
Net_END
} } // namespace Poco::Net
#endif // Net_DatagramSocketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// DialogSocket.h
//
// $Id: //poco/1.1.0/Net/include/Net/DialogSocket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/DialogSocket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_DialogSocket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API DialogSocket: public StreamSocket
@@ -207,7 +204,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_DialogSocket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// FTPClientSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/FTPClientSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/FTPClientSession.h#1 $
//
// Library: Net
// Package: FTP
@@ -40,26 +40,15 @@
#define Net_FTPClientSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_DialogSocket_INCLUDED
#include "Net/DialogSocket.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/DialogSocket.h"
#include "Poco/Timespan.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class SocketStream;
@@ -91,13 +80,13 @@ public:
TYPE_BINARY // TYPE I (Image)
};
FTPClientSession(const StreamSocket& socket);
explicit FTPClientSession(const StreamSocket& socket);
/// Creates an FTPClientSession using the given
/// connected socket for the control connection.
///
/// Passive mode will be used for data transfers.
FTPClientSession(const std::string& host, Foundation::UInt16 port = FTP_PORT);
FTPClientSession(const std::string& host, Poco::UInt16 port = FTP_PORT);
/// Creates an FTPClientSession using a socket connected
/// to the given host and port.
///
@@ -106,10 +95,10 @@ public:
virtual ~FTPClientSession();
/// Destroys the FTPClientSession.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout for socket operations.
Foundation::Timespan getTimeout() const;
Poco::Timespan getTimeout() const;
/// Returns the timeout for socket operations.
void setPassive(bool flag);
@@ -344,13 +333,13 @@ private:
FTPClientSession(const FTPClientSession&);
FTPClientSession& operator = (const FTPClientSession&);
DialogSocket _controlSocket;
SocketStream* _pDataStream;
bool _passiveMode;
FileType _fileType;
bool _supports1738;
bool _isOpen;
Foundation::Timespan _timeout;
DialogSocket _controlSocket;
SocketStream* _pDataStream;
bool _passiveMode;
FileType _fileType;
bool _supports1738;
bool _isOpen;
Poco::Timespan _timeout;
};
@@ -387,7 +376,7 @@ inline bool FTPClientSession::isPermanentNegative(int status)
}
Net_END
} } // namespace Poco::Net
#endif // Net_FTPClientSession_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// FTPStreamFactory.h
//
// $Id: //poco/1.1.0/Net/include/Net/FTPStreamFactory.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/FTPStreamFactory.h#1 $
//
// Library: Net
// Package: FTP
@@ -40,18 +40,13 @@
#define Net_FTPStreamFactory_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPSession_INCLUDED
#include "Net/HTTPSession.h"
#endif
#ifndef Foundation_URIStreamFactory_INCLUDED
#include "Foundation/URIStreamFactory.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/URIStreamFactory.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API FTPPasswordProvider
@@ -70,7 +65,7 @@ protected:
};
class Net_API FTPStreamFactory: public Foundation::URIStreamFactory
class Net_API FTPStreamFactory: public Poco::URIStreamFactory
/// An implementation of the URIStreamFactory interface
/// that handles File Transfer Protocol (ftp) URIs.
///
@@ -92,7 +87,7 @@ public:
~FTPStreamFactory();
/// Destroys the FTPStreamFactory.
std::istream* open(const Foundation::URI& uri);
std::istream* open(const Poco::URI& uri);
/// Creates and opens a HTTP stream for the given URI.
/// The URI must be a ftp://... URI.
///
@@ -128,8 +123,8 @@ public:
protected:
static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password);
static void getUserInfo(const Foundation::URI& uri, std::string& username, std::string& password);
static void getPathAndType(const Foundation::URI& uri, std::string& path, char& type);
static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password);
static void getPathAndType(const Poco::URI& uri, std::string& path, char& type);
private:
static std::string _anonymousPassword;
@@ -137,7 +132,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_FTPStreamFactory_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// FilePartSource.h
//
// $Id: //poco/1.1.0/Net/include/Net/FilePartSource.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/FilePartSource.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,19 +40,13 @@
#define Net_FilePartSource_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_PartSource_INCLUDED
#include "Net/PartSource.h"
#endif
#ifndef STD_FSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/PartSource.h"
#include <fstream>
#define STD_FSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API FilePartSource: public PartSource
@@ -88,7 +82,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_FilePartSource_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTMLForm.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTMLForm.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTMLForm.h#1 $
//
// Library: Net
// Package: HTML
@@ -40,27 +40,15 @@
#define Net_HTMLForm_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_NameValueCollection_INCLUDED
#include "Net/NameValueCollection.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/NameValueCollection.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
#ifndef STD_ISTREAM_INCLUDED
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_VECTOR_INCLUDED
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPRequest;
@@ -84,21 +72,24 @@ public:
/// Encoding must be either "application/x-www-form-urlencoded"
/// (which is the default) or "multipart/form-data".
HTMLForm(const HTTPRequest& request, std::istream& istr, PartHandler& handler);
HTMLForm(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler);
/// Creates a HTMLForm from the given HTTP request.
///
/// Uploaded files are passed to the given PartHandler.
HTMLForm(const HTTPRequest& request, std::istream& istr);
HTMLForm(const HTTPRequest& request, std::istream& requestBody);
/// Creates a HTMLForm from the given HTTP request.
///
/// Uploaded files are silently discarded.
HTMLForm(const HTTPRequest& request);
explicit HTMLForm(const HTTPRequest& request);
/// Creates a HTMLForm from the given HTTP request.
///
/// The request must be a GET request and the form data
/// must be in the query string (URL encoded).
///
/// For POST requests, you must use one of the constructors
/// taking an additional input stream for the request body.
~HTMLForm();
/// Destroys the HTMLForm.
@@ -136,6 +127,9 @@ public:
///
/// The request must be a GET request and the form data
/// must be in the query string (URL encoded).
///
/// For POST requests, you must use one of the overloads
/// taking an additional input stream for the request body.
void read(std::istream& istr, PartHandler& handler);
/// Reads the form data from the given input stream.
@@ -212,7 +206,7 @@ inline const std::string& HTMLForm::boundary() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTMLForm_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPBasicCredentials.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPBasicCredentials.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPBasicCredentials.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,12 +40,11 @@
#define Net_HTTPBasicCredentials_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#include "Poco/Net/Net.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPRequest;
@@ -114,7 +113,7 @@ inline const std::string& HTTPBasicCredentials::getPassword() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPBasicCredentials_INCLUDED

View File

@@ -40,24 +40,19 @@
#define Net_HTTPBasicStreamBuf_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_BufferedStreamBuf_INCLUDED
#include "Foundation/BufferedStreamBuf.h"
#endif
#ifndef Net_HTTPBufferAllocator_INCLUDED
#include "Net/HTTPBufferAllocator.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/BufferedStreamBuf.h"
#include "Poco/Net/HTTPBufferAllocator.h"
Net_BEGIN
namespace Poco {
namespace Net {
typedef Foundation::BasicBufferedStreamBuf<char, std::char_traits<char>, HTTPBufferAllocator> HTTPBasicStreamBuf;
typedef Poco::BasicBufferedStreamBuf<char, std::char_traits<char>, HTTPBufferAllocator> HTTPBasicStreamBuf;
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPBasicStreamBuf_INCLUDED

View File

@@ -40,19 +40,13 @@
#define Net_HTTPBufferAllocator_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_MemoryPool_INCLUDED
#include "Foundation/MemoryPool.h"
#endif
#ifndef STD_IOS_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/MemoryPool.h"
#include <ios>
#define STD_IOS_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HTTPBufferAllocator
@@ -68,11 +62,11 @@ public:
};
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPBufferAllocator_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPChunkedStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPChunkedStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPChunkedStream.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,26 +40,15 @@
#define Net_HTTPChunkedStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPBasicStreamBuf_INCLUDED
#include "Net/HTTPBasicStreamBuf.h"
#endif
#ifndef Foundation_MemoryPool_INCLUDED
#include "Foundation/MemoryPool.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPBasicStreamBuf.h"
#include "Poco/MemoryPool.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPSession;
@@ -111,7 +100,7 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
@@ -126,11 +115,11 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPChunkedStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPClientSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPClientSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPClientSession.h#1 $
//
// Library: Net
// Package: HTTPClient
@@ -40,26 +40,15 @@
#define Net_HTTPClientSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPSession_INCLUDED
#include "Net/HTTPSession.h"
#endif
#ifndef Net_SocketAddress_INCLUDED
#include "Net/SocketAddress.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Net/SocketAddress.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPRequest;
@@ -93,12 +82,15 @@ public:
HTTPClientSession();
/// Creates an unconnected HTTPClientSession.
HTTPClientSession(const StreamSocket& socket);
explicit HTTPClientSession(const StreamSocket& socket);
/// Creates a HTTPClientSession using the given socket.
/// The socket must not be connected. The session
/// takes ownership of the socket.
HTTPClientSession(const std::string& host, Foundation::UInt16 port = HTTPSession::HTTP_PORT);
explicit HTTPClientSession(const SocketAddress& address);
/// Creates a HTTPClientSession using the given address.
HTTPClientSession(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT);
/// Creates a HTTPClientSession using the given host and port.
virtual ~HTTPClientSession();
@@ -114,28 +106,28 @@ public:
const std::string& getHost() const;
/// Returns the host name of the target HTTP server.
void setPort(Foundation::UInt16 port);
void setPort(Poco::UInt16 port);
/// Sets the port number of the target HTTP server.
///
/// The port number must not be changed once there is an
/// open connection to the server.
Foundation::UInt16 getPort() const;
Poco::UInt16 getPort() const;
/// Returns the port number of the target HTTP server.
void setProxy(const std::string& host, Foundation::UInt16 port = HTTPSession::HTTP_PORT);
void setProxy(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT);
/// Sets the proxy host name and port number.
void setProxyHost(const std::string& host);
/// Sets the host name of the proxy server.
void setProxyPort(Foundation::UInt16 port);
void setProxyPort(Poco::UInt16 port);
/// Sets the port number of the proxy server.
const std::string& getProxyHost() const;
/// Returns the proxy host name.
Foundation::UInt16 getProxyPort() const;
Poco::UInt16 getProxyPort() const;
/// Returns the proxy port number.
virtual std::ostream& sendRequest(HTTPRequest& request);
@@ -197,14 +189,14 @@ protected:
/// Returns _expectResponseBody.
private:
std::string _host;
Foundation::UInt16 _port;
std::string _proxyHost;
Foundation::UInt16 _proxyPort;
bool _reconnect;
bool _expectResponseBody;
std::ostream* _pRequestStream;
std::istream* _pResponseStream;
std::string _host;
Poco::UInt16 _port;
std::string _proxyHost;
Poco::UInt16 _proxyPort;
bool _reconnect;
bool _expectResponseBody;
std::ostream* _pRequestStream;
std::istream* _pResponseStream;
};
@@ -217,7 +209,7 @@ inline const std::string& HTTPClientSession::getHost() const
}
inline Foundation::UInt16 HTTPClientSession::getPort() const
inline Poco::UInt16 HTTPClientSession::getPort() const
{
return _port;
}
@@ -229,7 +221,7 @@ inline const std::string& HTTPClientSession::getProxyHost() const
}
inline Foundation::UInt16 HTTPClientSession::getProxyPort() const
inline Poco::UInt16 HTTPClientSession::getProxyPort() const
{
return _proxyPort;
}
@@ -265,7 +257,7 @@ inline bool HTTPClientSession::getExpectResponseBody() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPClientSession_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPCookie.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPCookie.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPCookie.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,12 +40,11 @@
#define Net_HTTPCookie_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#include "Poco/Net/Net.h"
Net_BEGIN
namespace Poco {
namespace Net {
class NameValueCollection;
@@ -225,7 +224,7 @@ inline int HTTPCookie::getMaxAge() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPCookie_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPFixedLengthStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPFixedLengthStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPFixedLengthStream.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,23 +40,14 @@
#define Net_HTTPFixedLengthStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPBasicStreamBuf_INCLUDED
#include "Net/HTTPBasicStreamBuf.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPBasicStreamBuf.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPSession;
@@ -109,7 +100,7 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
@@ -124,11 +115,11 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPFixedLengthStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPHeaderStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPHeaderStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPHeaderStream.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,26 +40,15 @@
#define Net_HTTPHeaderStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPBasicStreamBuf_INCLUDED
#include "Net/HTTPBasicStreamBuf.h"
#endif
#ifndef Foundation_MemoryPool_INCLUDED
#include "Foundation/MemoryPool.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPBasicStreamBuf.h"
#include "Poco/MemoryPool.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPSession;
@@ -109,7 +98,7 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
@@ -124,11 +113,11 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPHeaderStream_INCLUDED

View File

@@ -40,18 +40,19 @@
#define Net_HTTPIOStream_INCLUDED
#include "Net/Net.h"
#include "Net/HTTPResponse.h"
#include "Foundation/UnbufferedStreamBuf.h"
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/UnbufferedStreamBuf.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPClientSession;
class Net_API HTTPResponseStreamBuf: public Foundation::UnbufferedStreamBuf
class Net_API HTTPResponseStreamBuf: public Poco::UnbufferedStreamBuf
{
public:
HTTPResponseStreamBuf(std::istream& istr);
@@ -103,7 +104,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPIOStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPMessage.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPMessage.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPMessage.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,15 +40,12 @@
#define Net_HTTPMessage_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_MessageHeader_INCLUDED
#include "Net/MessageHeader.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/MessageHeader.h"
Net_BEGIN
namespace Poco {
namespace Net {
class MediaType;
@@ -174,7 +171,7 @@ inline const std::string& HTTPMessage::getVersion() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPMessage_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPRequest.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPRequest.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequest.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,15 +40,12 @@
#define Net_HTTPRequest_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPMessage_INCLUDED
#include "Net/HTTPMessage.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPMessage.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HTTPRequest: public HTTPMessage
@@ -92,7 +89,7 @@ public:
void setHost(const std::string& host);
/// Sets the value of the Host header field.
void setHost(const std::string& host, Foundation::UInt16 port);
void setHost(const std::string& host, Poco::UInt16 port);
/// Sets the value of the Host header field.
const std::string& getHost() const;
@@ -173,7 +170,7 @@ inline const std::string& HTTPRequest::getURI() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPRequest_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPRequestHandler.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPRequestHandler.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequestHandler.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,12 +40,11 @@
#define Net_HTTPRequestHandler_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#include "Poco/Net/Net.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerRequest;
@@ -84,7 +83,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPRequestHandler_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPRequestHandlerFactory.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPRequestHandlerFactory.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,12 +40,11 @@
#define Net_HTTPRequestHandlerFactory_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#include "Poco/Net/Net.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerRequest;
@@ -75,7 +74,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPRequestHandlerFactory_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPResponse.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPResponse.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPResponse.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,25 +40,15 @@
#define Net_HTTPResponse_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPMessage_INCLUDED
#include "Net/HTTPMessage.h"
#endif
#ifndef Net_HTTPCookie_INCLUDED
#include "Net/HTTPCookie.h"
#endif
#ifndef Foundation_Timestamp_INCLUDED
#include "Foundation/Timestamp.h"
#endif
#ifndef STD_VECTOR_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPMessage.h"
#include "Poco/Net/HTTPCookie.h"
#include "Poco/Timestamp.h"
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPCookie;
@@ -168,10 +158,10 @@ public:
///
/// The reason phrase is set according to the status code.
void setDate(const Foundation::Timestamp& dateTime);
void setDate(const Poco::Timestamp& dateTime);
/// Sets the Date header to the given date/time value.
Foundation::Timestamp getDate() const;
Poco::Timestamp getDate() const;
/// Returns the value of the Date header.
void addCookie(const HTTPCookie& cookie);
@@ -272,7 +262,7 @@ inline const std::string& HTTPResponse::getReason() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPResponse_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServer.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServer.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServer.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,15 +40,12 @@
#define Net_HTTPServer_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_TCPServer_INCLUDED
#include "Net/TCPServer.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/TCPServer.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPRequestHandlerFactory;
@@ -88,7 +85,7 @@ public:
///
/// News threads are taken from the default thread pool.
HTTPServer(HTTPRequestHandlerFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams);
HTTPServer(HTTPRequestHandlerFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams);
/// Creates the HTTPServer, using the given ServerSocket.
///
/// The server takes ownership of the HTTPRequstHandlerFactory
@@ -103,7 +100,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServer_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerConnection.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerConnection.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerConnection.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,15 +40,12 @@
#define Net_HTTPServerConnection_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_TCPServerConnection_INCLUDED
#include "Net/TCPServerConnection.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/TCPServerConnection.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerParams;
@@ -75,7 +72,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerConnection_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerConnectionFactory.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerConnectionFactory.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerConnectionFactory.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,15 +40,12 @@
#define Net_HTTPServerConnectionFactory_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_TCPServerConnectionFactory_INCLUDED
#include "Net/TCPServerConnectionFactory.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/TCPServerConnectionFactory.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerParams;
@@ -76,7 +73,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerConnectionFactory_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerParams.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerParams.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerParams.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,15 +40,12 @@
#define Net_HTTPServerParams_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_TCPServerParams_INCLUDED
#include "Net/TCPServerParams.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/TCPServerParams.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HTTPServerParams: public TCPServerParams
@@ -89,10 +86,10 @@ public:
/// Returns the server software name and version that the server uses to
/// identify itself.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the connection timeout for HTTP connections.
const Foundation::Timespan& getTimeout() const;
const Poco::Timespan& getTimeout() const;
/// Returns the connection timeout for HTTP connections.
void setKeepAlive(bool keepAlive);
@@ -102,10 +99,10 @@ public:
bool getKeepAlive() const;
/// Returns true iff persistent connections are enabled.
void setKeepAliveTimeout(const Foundation::Timespan& timeout);
void setKeepAliveTimeout(const Poco::Timespan& timeout);
/// Sets the connection timeout for HTTP connections.
const Foundation::Timespan& getKeepAliveTimeout() const;
const Poco::Timespan& getKeepAliveTimeout() const;
/// Returns the connection timeout for HTTP connections.
void setMaxKeepAliveRequests(int maxKeepAliveRequests);
@@ -123,12 +120,12 @@ protected:
/// Destroys the HTTPServerParams.
private:
std::string _serverName;
std::string _softwareVersion;
Foundation::Timespan _timeout;
bool _keepAlive;
int _maxKeepAliveRequests;
Foundation::Timespan _keepAliveTimeout;
std::string _serverName;
std::string _softwareVersion;
Poco::Timespan _timeout;
bool _keepAlive;
int _maxKeepAliveRequests;
Poco::Timespan _keepAliveTimeout;
};
@@ -147,7 +144,7 @@ inline const std::string& HTTPServerParams::getSoftwareVersion() const
}
inline const Foundation::Timespan& HTTPServerParams::getTimeout() const
inline const Poco::Timespan& HTTPServerParams::getTimeout() const
{
return _timeout;
}
@@ -165,13 +162,13 @@ inline int HTTPServerParams::getMaxKeepAliveRequests() const
}
inline const Foundation::Timespan& HTTPServerParams::getKeepAliveTimeout() const
inline const Poco::Timespan& HTTPServerParams::getKeepAliveTimeout() const
{
return _keepAliveTimeout;
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerParams_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerRequest.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerRequest.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerRequest.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,22 +40,14 @@
#define Net_HTTPServerRequest_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPRequest_INCLUDED
#include "Net/HTTPRequest.h"
#endif
#ifndef Net_SocketAddress_INCLUDED
#include "Net/SocketAddress.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPRequest.h"
#include "Poco/Net/SocketAddress.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerSession;
@@ -134,7 +126,7 @@ inline const HTTPServerParams& HTTPServerRequest::serverParams() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerRequest_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerResponse.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerResponse.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerResponse.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,19 +40,13 @@
#define Net_HTTPServerResponse_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPResponse_INCLUDED
#include "Net/HTTPResponse.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPResponse.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerSession;
@@ -122,7 +116,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerResponse_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPServerSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPServerSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPServerSession.h#1 $
//
// Library: Net
// Package: HTTPServer
@@ -40,21 +40,14 @@
#define Net_HTTPServerSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPSession_INCLUDED
#include "Net/HTTPSession.h"
#endif
#ifndef Net_SocketAddress_INCLUDED
#include "Net/SocketAddress.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Timespan.h"
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPServerParams;
@@ -82,13 +75,13 @@ public:
/// Returns the server's address.
private:
bool _firstRequest;
Foundation::Timespan _keepAliveTimeout;
int _maxKeepAliveRequests;
bool _firstRequest;
Poco::Timespan _keepAliveTimeout;
int _maxKeepAliveRequests;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPServerSession_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSession.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,22 +40,15 @@
#define Net_HTTPSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#ifndef STD_IOS_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Timespan.h"
#include "Poco/Exception.h"
#include <ios>
#define STD_IOS_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HTTPSession
@@ -79,10 +72,10 @@ public:
/// Returns the value of the keep-alive flag for
/// this session.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout for the HTTP session.
Foundation::Timespan getTimeout() const;
Poco::Timespan getTimeout() const;
/// Returns the timeout for the HTTP session.
bool connected() const;
@@ -91,6 +84,13 @@ public:
void abort();
/// Aborts a session in progress by shutting down
/// and closing the underlying socket.
const Poco::Exception* networkException() const;
/// If sending or receiving data over the underlying
/// socket connection resulted in an exception, a
/// pointer to this exception is returned.
///
/// Otherwise, NULL is returned.
enum
{
@@ -154,6 +154,9 @@ protected:
void close();
/// Closes the underlying socket.
void setException(const Poco::Exception& exc);
/// Stores a clone of the exception.
private:
enum
{
@@ -163,12 +166,13 @@ private:
HTTPSession(const HTTPSession&);
HTTPSession& operator = (const HTTPSession&);
StreamSocket _socket;
char* _pBuffer;
char* _pCurrent;
char* _pEnd;
bool _keepAlive;
Foundation::Timespan _timeout;
StreamSocket _socket;
char* _pBuffer;
char* _pCurrent;
char* _pEnd;
bool _keepAlive;
Poco::Timespan _timeout;
Poco::Exception* _pException;
friend class HTTPStreamBuf;
friend class HTTPHeaderStreamBuf;
@@ -186,7 +190,7 @@ inline bool HTTPSession::getKeepAlive() const
}
inline Foundation::Timespan HTTPSession::getTimeout() const
inline Poco::Timespan HTTPSession::getTimeout() const
{
return _timeout;
}
@@ -198,7 +202,13 @@ inline StreamSocket& HTTPSession::socket()
}
Net_END
inline const Poco::Exception* HTTPSession::networkException() const
{
return _pException;
}
} } // namespace Poco::Net
#endif // Net_HTTPSession_INCLUDED

View File

@@ -0,0 +1,154 @@
//
// HTTPSessionFactory.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSessionFactory.h#1 $
//
// Library: Net
// Package: HTTPClient
// Module: HTTPSessionFactory
//
// Definition of the HTTPSessionFactory class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_HTTPSessionFactoryMgr_INCLUDED
#define Net_HTTPSessionFactoryMgr_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Mutex.h"
#include "Poco/URI.h"
#include "Poco/SingletonHolder.h"
#include "Poco/SharedPtr.h"
#include <map>
namespace Poco {
namespace Net {
class HTTPSessionInstantiator;
class HTTPClientSession;
class Net_API HTTPSessionFactory
/// A factory for HTTPClientSession objects.
///
/// Given a URI, this class creates a HTTPClientSession
/// (for http) or a HTTPSClientSession (for https) for
/// accessing the URI.
///
/// The actual work of creating the session is done by
/// HTTPSessionInstantiator objects that must be registered
/// with a HTTPSessionFactory.
{
public:
HTTPSessionFactory();
/// Creates the HTTPSessionFactory.
HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort);
/// Creates the HTTPSessionFactory and sets the proxy host and port.
~HTTPSessionFactory();
/// Destroys the HTTPSessionFactory.
void registerProtocol(const std::string& protocol, HTTPSessionInstantiator* pSessionInstantiator);
/// Registers the session instantiator for the given protocol.
/// The factory takes ownership of the SessionInstantiator.
///
/// A protocol can be registered more than once. However, only the instantiator
/// that has been registered first is used. Also, for each call to
/// registerProtocol(), a corresponding call to unregisterProtocol() must
/// be made.
void unregisterProtocol(const std::string& protocol);
/// Removes the registration of a protocol.
///
/// Throws a NotFoundException if no instantiator has been registered
/// for the given protocol.
bool supportsProtocol(const std::string& protocol);
/// Returns true if a session instantiator for the given protocol has been registered.
HTTPClientSession* createClientSession(const Poco::URI& uri);
/// Creates a client session for the given uri scheme. Throws exception if no factory is registered for the given scheme
const std::string& proxyHost() const;
/// Returns the proxy host, if one has been set, or an empty string otherwise.
Poco::UInt16 proxyPort() const;
/// Returns the proxy port number, if one has been set, or zero otherwise.
void setProxy(const std::string& proxyHost, Poco::UInt16 proxyPort);
/// Sets the proxy host and port number.
static HTTPSessionFactory& defaultFactory();
/// Returns the default HTTPSessionFactory.
private:
struct InstantiatorInfo
{
HTTPSessionInstantiator* pIn;
int cnt;
InstantiatorInfo(HTTPSessionInstantiator* pInst);
// no destructor!!! this is by purpose, don't add one!
};
HTTPSessionFactory(const HTTPSessionFactory&);
HTTPSessionFactory& operator = (const HTTPSessionFactory&);
typedef std::map<std::string, InstantiatorInfo> Instantiators;
Instantiators _instantiators;
std::string _proxyHost;
Poco::UInt16 _proxyPort;
mutable Poco::FastMutex _mutex;
};
//
// inlines
//
inline const std::string& HTTPSessionFactory::proxyHost() const
{
return _proxyHost;
}
inline Poco::UInt16 HTTPSessionFactory::proxyPort() const
{
return _proxyPort;
}
} } // namespace Poco::Net
#endif // Net_HTTPSessionFactoryMgr_INCLUDED

View File

@@ -0,0 +1,116 @@
//
// HTTPSessionInstantiator.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPSessionInstantiator.h#1 $
//
// Library: Net
// Package: HTTPClient
// Module: HTTPSessionInstantiator
//
// Definition of the HTTPSessionInstantiator class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_HTTPSessionInstantiator_INCLUDED
#define Net_HTTPSessionInstantiator_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/URI.h"
namespace Poco {
namespace Net {
class HTTPClientSession;
class Net_API HTTPSessionInstantiator
/// A factory for HTTPClientSession objects.
///
/// Creates a HTTP session for a given URI.
/// A HTTPSessionInstantiator is not used directly.
/// Instances are registered with a HTTPSessionFactory,
/// and used through it.
{
public:
HTTPSessionInstantiator();
/// Creates the HTTPSessionInstantiator.
virtual ~HTTPSessionInstantiator();
/// Destroys the HTTPSessionInstantiator.
virtual HTTPClientSession* createClientSession(const Poco::URI& uri);
/// Creates a HTTPClientSession for the given URI.
static void registerInstantiator();
/// Registers the instantiator with the global HTTPSessionFactory.
static void unregisterInstantiator();
/// Unregisters the factory with the global HTTPSessionFactory.
protected:
void setProxy(const std::string& host, Poco::UInt16 port);
/// Sets the proxy host and port.
/// Called by HTTPSessionFactory.
const std::string& proxyHost() const;
/// Returns the proxy post.
Poco::UInt16 proxyPort() const;
/// Returns the proxy port.
private:
std::string _proxyHost;
Poco::UInt16 _proxyPort;
friend class HTTPSessionFactory;
};
//
// inlines
//
inline const std::string& HTTPSessionInstantiator::proxyHost() const
{
return _proxyHost;
}
inline Poco::UInt16 HTTPSessionInstantiator::proxyPort() const
{
return _proxyPort;
}
} } // namespace Poco::Net
#endif // Net_HTTPSessionInstantiator_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPStream.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,26 +40,15 @@
#define Net_HTTPStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPBasicStreamBuf_INCLUDED
#include "Net/HTTPBasicStreamBuf.h"
#endif
#ifndef Foundation_MemoryPool_INCLUDED
#include "Foundation/MemoryPool.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPBasicStreamBuf.h"
#include "Poco/MemoryPool.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class HTTPSession;
@@ -110,7 +99,7 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
@@ -125,11 +114,11 @@ public:
void operator delete(void* ptr);
private:
static Foundation::MemoryPool _pool;
static Poco::MemoryPool _pool;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HTTPStreamFactory.h
//
// $Id: //poco/1.1.0/Net/include/Net/HTTPStreamFactory.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HTTPStreamFactory.h#1 $
//
// Library: Net
// Package: HTTP
@@ -40,21 +40,16 @@
#define Net_HTTPStreamFactory_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_HTTPSession_INCLUDED
#include "Net/HTTPSession.h"
#endif
#ifndef Foundation_URIStreamFactory_INCLUDED
#include "Foundation/URIStreamFactory.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/URIStreamFactory.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HTTPStreamFactory: public Foundation::URIStreamFactory
class Net_API HTTPStreamFactory: public Poco::URIStreamFactory
/// An implementation of the URIStreamFactory interface
/// that handles Hyper-Text Transfer Protocol (http) URIs.
{
@@ -62,7 +57,7 @@ public:
HTTPStreamFactory();
/// Creates the HTTPStreamFactory.
HTTPStreamFactory(const std::string& proxyHost, Foundation::UInt16 proxyPort = HTTPSession::HTTP_PORT);
HTTPStreamFactory(const std::string& proxyHost, Poco::UInt16 proxyPort = HTTPSession::HTTP_PORT);
/// Creates the HTTPStreamFactory.
///
/// HTTP connections will use the given proxy.
@@ -70,11 +65,20 @@ public:
virtual ~HTTPStreamFactory();
/// Destroys the HTTPStreamFactory.
virtual std::istream* open(const Foundation::URI& uri);
virtual std::istream* open(const Poco::URI& uri);
/// Creates and opens a HTTP stream for the given URI.
/// The URI must be a http://... URI.
///
/// Throws a NetException if anything goes wrong.
///
/// Redirect responses are handled and the redirect
/// location is automatically resolved, as long
/// as the redirect location is still accessible
/// via the HTTP protocol. If a redirection to
/// a non http://... URI is received, a
/// UnsupportedRedirectException exception is thrown.
/// The offending URI can then be obtained via the message()
/// method of UnsupportedRedirectException.
static void registerFactory();
/// Registers the HTTPStreamFactory with the
@@ -86,12 +90,12 @@ private:
MAX_REDIRECTS = 10
};
std::string _proxyHost;
Foundation::UInt16 _proxyPort;
std::string _proxyHost;
Poco::UInt16 _proxyPort;
};
Net_END
} } // namespace Poco::Net
#endif // Net_HTTPStreamFactory_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// HostEntry.h
//
// $Id: //poco/1.1.0/Net/include/Net/HostEntry.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/HostEntry.h#1 $
//
// Library: Net
// Package: NetCore
@@ -40,22 +40,14 @@
#define Net_HostEntry_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketDefs_INCLUDED
#include "Net/SocketDefs.h"
#endif
#ifndef Net_IPAddress_INLCUDED
#include "Net/IPAddress.h"
#endif
#ifndef STD_VECTOR_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/IPAddress.h"
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API HostEntry
@@ -135,7 +127,7 @@ inline void swap(HostEntry& h1, HostEntry& h2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_HostEntry_INCLUDED

View File

@@ -0,0 +1,107 @@
//
// ICMPClient.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPClient.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPClient
//
// Definition of the ICMPClient class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPClient_INCLUDED
#define Net_ICMPClient_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/ICMPSocket.h"
#include "Poco/Net/ICMPEventArgs.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/BasicEvent.h"
namespace Poco {
namespace Net {
class Net_API ICMPClient
/// This class provides ICMP Ping functionality.
///
/// The events are available when class is instantiated
/// and non-static member functions are called.
///
/// A "lightweight" alternative is direct (without instantiation)
/// use of static member functions.
{
public:
mutable Poco::BasicEvent<ICMPEventArgs> pingBegin;
mutable Poco::BasicEvent<ICMPEventArgs> pingReply;
mutable Poco::BasicEvent<ICMPEventArgs> pingError;
mutable Poco::BasicEvent<ICMPEventArgs> pingEnd;
explicit ICMPClient(IPAddress::Family family);
/// Creates an ICMP client.
~ICMPClient();
/// Destroys the ICMP client.
int ping(SocketAddress& address, int repeat = 1) const;
/// Pings the specified address [repeat] times.
/// Notifications are posted for events.
///
/// Returns the number of valid replies.
int ping(const std::string& address, int repeat = 1) const;
/// Calls ICMPClient::ping(SocketAddress&, int) and
/// returns the result.
///
/// Returns the number of valid replies.
static int ping(SocketAddress& address, IPAddress::Family family, int repeat = 1);
/// Pings the specified address [repeat] times.
/// Notifications are not posted for events.
///
/// Returns the number of valid replies.
static int pingIPv4(const std::string& address, int repeat = 1);
/// Calls ICMPClient::ping(SocketAddress&, int) and
/// returns the result.
///
/// Returns the number of valid replies.
private:
mutable IPAddress::Family _family;
};
} } // namespace Poco::Net
#endif // Net_ICMPClient_INCLUDED

View File

@@ -0,0 +1,188 @@
//
// ICMPEventArgs.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPEventArgs.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPEventArgs
//
// Definition of ICMPEventArgs.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPEventArgs_INCLUDED
#define Net_ICMPEventArgs_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketAddress.h"
#include <vector>
#undef min // macros collide with valarray::min() and valarray::max()
#undef max
#include <valarray>
namespace Poco {
namespace Net {
class Net_API ICMPEventArgs
/// The purpose of the ICMPEventArgs class is to be used as template parameter
/// to instantiate event members in ICMPClient class.
/// When clients register for an event notification, the reference to the class is
/// passed to the handler function to provide information about the event.
{
public:
ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl);
/// Creates ICMPEventArgs.
virtual ~ICMPEventArgs();
/// Destroys ICMPEventArgs.
std::string hostName() const;
/// Tries to resolve the target IP address into host name.
/// If unsuccessful, all exceptions are silently ignored and
/// the IP address is returned.
std::string hostAddress() const;
/// Returns the target IP address.
int repetitions() const;
/// Returns the number of repetitions for the ping operation.
int dataSize() const;
/// Returns the packet data size in bytes.
int ttl() const;
/// Returns time to live.
int sent() const;
/// Returns the number of packets sent.
int received() const;
/// Returns the number of packets received.
int replyTime(int index = -1) const;
/// Returns the reply time for the request specified with index.
/// If index == -1 (default), returns the most recent reply time.
const std::string& error(int index = -1) const;
/// Returns the error string for the request specified with index.
/// If index == -1 (default), returns the most recent error string.
int minRTT() const;
/// Returns the minimum round trip time for a sequence of requests.
int maxRTT() const;
/// Returns the maximum round trip time for a sequence of requests.
int avgRTT() const;
/// Returns the average round trip time for a sequence of requests.
float percent() const;
/// Returns the success percentage for a sequence of requests.
private:
ICMPEventArgs();
void setRepetitions(int repetitions);
void setDataSize(int dataSize);
void setTTL(int ttl);
void setReplyTime(int index, int time);
void setError(int index, const std::string& text);
ICMPEventArgs& operator ++ ();
ICMPEventArgs operator ++ (int);
static int zeroVal(int n);
SocketAddress _address;
int _sent;
int _dataSize;
int _ttl;
std::valarray<int> _rtt;
std::vector<std::string> _errors;
friend class ICMPClient;
};
//
// inlines
//
inline int ICMPEventArgs::repetitions() const
{
return (int) _rtt.size();
}
inline void ICMPEventArgs::setDataSize(int dataSize)
{
_dataSize = dataSize;
}
inline int ICMPEventArgs::dataSize() const
{
return _dataSize;
}
inline void ICMPEventArgs::setTTL(int ttl)
{
_ttl = ttl;
}
inline int ICMPEventArgs::ttl() const
{
return _ttl;
}
inline int ICMPEventArgs::sent() const
{
return _sent;
}
inline int ICMPEventArgs::minRTT() const
{
return _rtt.min();
}
inline int ICMPEventArgs::maxRTT() const
{
return _rtt.max();
}
} } // namespace Poco::Net
#endif

View File

@@ -0,0 +1,111 @@
//
// ICMPPacket.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPPacket.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPPacket
//
// Definition of the ICMPPacket class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPPacket_INCLUDED
#define Net_ICMPPacket_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/ICMPPacketImpl.h"
namespace Poco {
namespace Net {
class Net_API ICMPPacket
/// This class is the ICMP packet abstraction.
{
public:
ICMPPacket(IPAddress::Family family, int dataSize = 48);
/// Creates an ICMPPacket of specified family.
~ICMPPacket();
/// Destroys the ICMPPacket.
const Poco::UInt8* packet();
/// Returns raw ICMP packet. ICMP header and data are included in the returned packet.
int packetSize() const;
/// Returns the total length of packet (header + data);
Poco::UInt16 sequence() const;
/// Returns the most recent sequence number generated.
void setDataSize(int dataSize);
/// Sets data size.
int getDataSize() const;
/// Returns data size.
int maxPacketSize() const;
/// Returns the total length of packet (header + data);
struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const;
/// Returns current epoch time if either buffer or length are equal to zero.
/// Otherwise, it extracts the time value from the supplied buffer and
/// returns the extracted value.
///
/// Supplied buffer includes IP header, ICMP header and data.
bool validReplyID(Poco::UInt8* buffer, int length) const;
/// Returns true if the extracted id is recognized
/// (equals the process id).
///
/// Supplied buffer includes IP header, ICMP header and data.
std::string errorDescription(Poco::UInt8* buffer, int length);
/// Returns error description string.
/// If supplied buffer contains an ICMP echo reply packet, an
/// empty string is returned indicating the absence of error.
///
/// Supplied buffer includes IP header, ICMP header and data.
std::string typeDescription(int typeId);
/// Returns the description of the packet type.
private:
ICMPPacketImpl* _pImpl;
};
} } // namespace Poco::Net
#endif // Net_ICMPPacket_INCLUDED

View File

@@ -0,0 +1,163 @@
//
// ICMPPacketImpl.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPPacketImpl.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPPacketImpl
//
// Definition of the ICMPPacketImpl class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPPacketImpl_INCLUDED
#define Net_ICMPPacketImpl_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Net/Socket.h"
namespace Poco {
namespace Net {
class Net_API ICMPPacketImpl
/// This is the abstract class for ICMP packet implementations.
{
public:
ICMPPacketImpl(int dataSize = 48);
/// Constructor. Creates an ICMPPacketImpl.
virtual ~ICMPPacketImpl();
/// Destructor.
const Poco::UInt8* packet(bool init = true);
/// Returns raw ICMP packet.
/// ICMP header and data are included in the packet.
/// If init is true, initPacket() is called.
virtual int packetSize() const = 0;
/// Returns the total size of packet (ICMP header + data) in number of octets.
/// Must be overriden.
virtual int maxPacketSize() const;
/// Returns the maximum permitted size of packet in number of octets.
Poco::UInt16 sequence() const;
/// Returns the most recent sequence number generated.
void setDataSize(int dataSize);
/// Sets data size.
int getDataSize() const;
/// Returns data size.
virtual struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const = 0;
/// Returns current epoch time if either argument is equal to zero.
/// Otherwise, it extracts the time value from the supplied buffer.
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
virtual bool validReplyID(unsigned char* buffer, int length) const = 0;
/// Returns true if the extracted id is recognized
/// (i.e. equals the process id).
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
virtual std::string errorDescription(Poco::UInt8* buffer, int length) = 0;
/// Returns error description string.
/// If supplied buffer contains an ICMP echo reply packet, an
/// empty string is returned indicating the absence of error.
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
virtual std::string typeDescription(int typeId) = 0;
/// Returns the description of the packet type.
/// Must be overriden.
static const Poco::UInt16 MAX_PACKET_SIZE;
static const Poco::UInt16 MAX_SEQ_VALUE;
protected:
Poco::UInt16 nextSequence();
/// Increments sequence number and returns the new value.
void resetSequence();
/// Resets the sequence to zero.
virtual void initPacket() = 0;
/// (Re)assembles the packet.
/// Must be overriden.
Poco::UInt16 checksum(Poco::UInt16 *addr, Poco::Int32 len);
/// Calculates the checksum for supplied buffer.
private:
Poco::UInt16 _seq;
Poco::UInt8* _pPacket;
int _dataSize;
};
//
// inlines
//
inline Poco::UInt16 ICMPPacketImpl::sequence() const
{
return _seq;
}
inline Poco::UInt16 ICMPPacketImpl::nextSequence()
{
return ++_seq;
}
inline void ICMPPacketImpl::resetSequence()
{
_seq = 0;
}
inline int ICMPPacketImpl::maxPacketSize() const
{
return MAX_PACKET_SIZE;
}
} } // namespace Poco::Net
#endif // Net_ICMPPacketImpl_INCLUDED

View File

@@ -0,0 +1,139 @@
//
// ICMPSocket.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPSocket.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPSocket
//
// Definition of the ICMPSocket class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPSocket_INCLUDED
#define Net_ICMPSocket_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
namespace Poco {
namespace Net {
class Net_API ICMPSocket: public Socket
/// This class provides an interface to an
/// ICMP client socket.
{
public:
ICMPSocket(IPAddress::Family family, int dataSize = 48, int ttl = 128, int timeout = 500000);
/// Creates an unconnected ICMP socket.
///
/// The socket will be created for the
/// given address family.
ICMPSocket(const Socket& socket);
/// Creates the ICMPSocket with the SocketImpl
/// from another socket. The SocketImpl must be
/// a DatagramSocketImpl, otherwise an InvalidArgumentException
/// will be thrown.
~ICMPSocket();
/// Destroys the ICMPSocket.
ICMPSocket& operator = (const Socket& socket);
/// Assignment operator.
///
/// Releases the socket's SocketImpl and
/// attaches the SocketImpl from the other socket and
/// increments the reference count of the SocketImpl.
int sendTo(const SocketAddress& address, int flags = 0);
/// Sends an ICMP request through
/// the socket to the given address.
///
/// Returns the number of bytes sent.
int receiveFrom(SocketAddress& address, int flags = 0);
/// Receives data from the socket.
/// Stores the address of the sender in address.
///
/// Returns the time elapsed since the originating
/// request was sent.
int dataSize() const;
/// Returns the data size in bytes.
int ttl() const;
/// Returns the Time-To-Live value.
int timeout() const;
/// Returns the socket timeout value.
protected:
ICMPSocket(SocketImpl* pImpl);
/// Creates the Socket and attaches the given SocketImpl.
/// The socket takes owership of the SocketImpl.
///
/// The SocketImpl must be a ICMPSocketImpl, otherwise
/// an InvalidArgumentException will be thrown.
private:
int _dataSize;
int _ttl;
int _timeout;
};
//
// inlines
//
inline int ICMPSocket::dataSize() const
{
return _dataSize;
}
inline int ICMPSocket::ttl() const
{
return _ttl;
}
inline int ICMPSocket::timeout() const
{
return _timeout;
}
} } // namespace Poco::Net
#endif // Net_ICMPSocket_INCLUDED

View File

@@ -0,0 +1,84 @@
//
// ICMPSocketImpl.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPSocketImpl.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPSocketImpl
//
// Definition of the ICMPSocketImpl class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPSocketImpl_INCLUDED
#define Net_ICMPSocketImpl_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/RawSocketImpl.h"
#include "Poco/Net/ICMPPacket.h"
#include "Poco/Timestamp.h"
namespace Poco {
namespace Net {
class Net_API ICMPSocketImpl: public RawSocketImpl
/// This class implements an ICMP socket.
{
public:
ICMPSocketImpl(IPAddress::Family family, int dataSize, int ttl, int timeout);
/// Creates an unconnected ICMP socket.
///
/// The socket will be created for the given address family.
int sendTo(const void*, int, const SocketAddress& address, int flags = 0);
/// Sends an ICMP request through the socket to the given address.
///
/// Returns the number of bytes sent.
int receiveFrom(void*, int, SocketAddress& address, int flags = 0);
/// Receives data from the socket.
/// Stores the address of the sender in address.
///
/// Returns the time elapsed since the originating request was sent.
protected:
~ICMPSocketImpl();
private:
ICMPPacket _icmpPacket;
};
} } // namespace Poco::Net
#endif // Net_ICMPSocketImpl_INCLUDED

View File

@@ -0,0 +1,186 @@
//
// ICMPv4PacketImpl.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/ICMPv4PacketImpl.h#1 $
//
// Library: Net
// Package: ICMP
// Module: ICMPv4PacketImpl
//
// Definition of the ICMPv4PacketImpl class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_ICMPv4PacketImpl_INCLUDED
#define Net_ICMPv4PacketImpl_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/ICMPPacketImpl.h"
namespace Poco {
namespace Net {
class Net_API ICMPv4PacketImpl : public ICMPPacketImpl
/// This class implements the ICMPv4 packet.
/// Parts are based on original ICMP code by
/// Mike Muuss
/// U. S. Army Ballistic Research Laboratory
/// December, 1983
{
public:
// ICMPv4 header
struct Header
{
Poco::UInt8 type; // ICMP packet type
Poco::UInt8 code; // Type sub code
Poco::UInt16 checksum;
Poco::UInt16 id;
Poco::UInt16 seq;
};
enum MessageType
{
ECHO_REPLY,
ICMP_1,
ICMP_2,
DESTINATION_UNREACHABLE,
SOURCE_QUENCH,
REDIRECT,
ICMP_6,
ICMP_7,
ECHO,
ICMP_9,
ICMP_10,
TIME_EXCEEDED,
PARAMETER_PROBLEM,
TIMESTAMP,
TIMESTAMP_REPLY,
INFORMATION_REQUEST,
INFORMATION_REPLY,
MESSAGE_TYPE_UNKNOWN, // non-standard default, must remain last but one
MESSAGE_TYPE_LENGTH // length indicator, must remain last
};
enum DestinationUnreachableCode
{
NET_UNREACHABLE,
HOST_UNREACHABLE,
PROTOCOL_UNREACHABLE,
PORT_UNREACHABLE,
FRAGMENTATION_NEEDED_AND_DF_SET,
SOURCE_ROUTE_FAILED,
DESTINATION_UNREACHABLE_UNKNOWN, // non-standard default, must remain last but one
DESTINATION_UNREACHABLE_LENGTH // length indicator, must remain last
};
enum RedirectMessageCode
{
REDIRECT_NETWORK,
REDIRECT_HOST,
REDIRECT_SERVICE_NETWORK,
REDIRECT_SERVICE_HOST,
REDIRECT_MESSAGE_UNKNOWN, // non-standard default, must remain last but one
REDIRECT_MESSAGE_LENGTH // length indicator, must remain last
};
enum TimeExceededCode
{
TIME_TO_LIVE,
FRAGMENT_REASSEMBLY,
TIME_EXCEEDED_UNKNOWN, // non-standard default, must remain last but one
TIME_EXCEEDED_LENGTH // length indicator, must remain last
};
enum ParameterProblemCode
{
POINTER_INDICATES_THE_ERROR,
PARAMETER_PROBLEM_UNKNOWN, // non-standard default, must remain last but one
PARAMETER_PROBLEM_LENGTH // length indicator, must remain last
};
ICMPv4PacketImpl(int dataSize = 48);
/// Constructor. Creates an ICMPv4PacketImpl.
~ICMPv4PacketImpl();
/// Destructor.
int packetSize() const;
/// Returns the total length of packet (header + data);
struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const;
/// Returns current epoch time if either buffer or length are equal to zero.
/// Otherwise, it extracts the time value from the supplied buffer.
///
/// Buffer includes IP header, ICMP header and data.
bool validReplyID(Poco::UInt8* buffer, int length) const;
/// Returns true if the extracted id is recognized
/// (i.e. equals the process id).
///
/// Buffer includes IP header, ICMP header and data.
virtual std::string errorDescription(Poco::UInt8* buffer, int length);
/// Returns error description string.
/// If supplied buffer contains ICMPv4 echo reply packet, an
/// empty string is returned indicating the absence of error.
///
/// Buffer includes IP header, ICMP header and data.
virtual std::string typeDescription(int typeId);
/// Returns the description of the packet type.
static const Poco::UInt16 MAX_PACKET_SIZE;
static const std::string MESSAGE_TYPE[MESSAGE_TYPE_LENGTH];
static const Poco::UInt8 DESTINATION_UNREACHABLE_TYPE; // 3
static const Poco::UInt8 SOURCE_QUENCH_TYPE; // 4
static const Poco::UInt8 REDIRECT_MESSAGE_TYPE; // 5
static const Poco::UInt8 TIME_EXCEEDED_TYPE; // 11
static const Poco::UInt8 PARAMETER_PROBLEM_TYPE; // 12
private:
void initPacket();
Header* header(Poco::UInt8* buffer, int length) const;
Poco::UInt8* data(Poco::UInt8* buffer, int length) const;
static const std::string DESTINATION_UNREACHABLE_CODE[DESTINATION_UNREACHABLE_LENGTH];
static const std::string REDIRECT_MESSAGE_CODE[REDIRECT_MESSAGE_LENGTH];
static const std::string TIME_EXCEEDED_CODE[TIME_EXCEEDED_LENGTH];
static const std::string PARAMETER_PROBLEM_CODE[PARAMETER_PROBLEM_LENGTH];
Poco::UInt16 _seq;
};
} } // namespace Poco::Net
#endif // Net_ICMPv4PacketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// IPAddress.h
//
// $Id: //poco/1.1.0/Net/include/Net/IPAddress.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/IPAddress.h#1 $
//
// Library: Net
// Package: NetCore
@@ -40,15 +40,12 @@
#define Net_IPAddress_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketDefs_INCLUDED
#include "Net/SocketDefs.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
Net_BEGIN
namespace Poco {
namespace Net {
class IPAddressImpl;
@@ -341,7 +338,7 @@ inline void swap(IPAddress& a1, IPAddress& a2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_IPAddress_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MailMessage.h
//
// $Id: //poco/1.1.0/Net/include/Net/MailMessage.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MailMessage.h#1 $
//
// Library: Net
// Package: Mail
@@ -40,25 +40,15 @@
#define Net_MailMessage_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_MessageHeader_INCLUDED
#include "Net/MessageHeader.h"
#endif
#ifndef Net_MailRecipient_INCLUDED
#include "Net/MailRecipient.h"
#endif
#ifndef Foundation_Timestamp_INCLUDED
#include "Foundation/Timestamp.h"
#endif
#ifndef STD_VECTOR_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/MessageHeader.h"
#include "Poco/Net/MailRecipient.h"
#include "Poco/Timestamp.h"
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class MediaType;
@@ -148,10 +138,10 @@ public:
const std::string& getContentType() const;
/// Returns the content type for the message.
void setDate(const Foundation::Timestamp& dateTime);
void setDate(const Poco::Timestamp& dateTime);
/// Sets the Date header to the given date/time value.
Foundation::Timestamp getDate() const;
Poco::Timestamp getDate() const;
/// Returns the value of the Date header.
bool isMultipart() const;
@@ -257,7 +247,7 @@ inline const std::string& MailMessage::getContent() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_MailMessage_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MailRecipient.h
//
// $Id: //poco/1.1.0/Net/include/Net/MailRecipient.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MailRecipient.h#1 $
//
// Library: Net
// Package: Mail
@@ -40,12 +40,11 @@
#define Net_MailRecipient_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#include "Poco/Net/Net.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API MailRecipient
@@ -137,7 +136,7 @@ inline void swap(MailRecipient& r1, MailRecipient& r2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_MailRecipient_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MailStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/MailStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MailStream.h#1 $
//
// Library: Net
// Package: Mail
@@ -40,26 +40,17 @@
#define Net_MailStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_UnbufferedStreamBuf_INCLUDED
#include "Foundation/UnbufferedStreamBuf.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/UnbufferedStreamBuf.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API MailStreamBuf: public Foundation::UnbufferedStreamBuf
class Net_API MailStreamBuf: public Poco::UnbufferedStreamBuf
/// The sole purpose of this stream buffer is to replace
/// a "\r\n.\r\n" character sequence with a "\r\n..\r\n" sequence for
/// output streams and vice-versa for input streams.
@@ -171,7 +162,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_MailStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MediaType.h
//
// $Id: //poco/1.1.0/Net/include/Net/MediaType.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MediaType.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,15 +40,12 @@
#define Net_MediaType_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_NameValueCollection_INCLUDED
#include "Net/NameValueCollection.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/NameValueCollection.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API MediaType
@@ -167,7 +164,7 @@ inline void swap(MediaType& m1, MediaType& m2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_MediaType_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MessageHeader.h
//
// $Id: //poco/1.1.0/Net/include/Net/MessageHeader.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MessageHeader.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,27 +40,15 @@
#define Net_MessageHeader_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_NameValueCollection_INCLUDED
#include "Net/NameValueCollection.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/NameValueCollection.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
#ifndef STD_ISTREAM_INCLUDED
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_VECTOR_INCLUDED
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API MessageHeader: public NameValueCollection
@@ -163,7 +151,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_MessageHeader_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MulticastSocket.h
//
// $Id: //poco/1.1.0/Net/include/Net/MulticastSocket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MulticastSocket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,18 +40,13 @@
#define Net_MulticastSocket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_DatagramSocket_INCLUDED
#include "Net/DatagramSocket.h"
#endif
#ifndef Net_NetworkInterface_INCLUDED
#include "Net/NetworkInterface.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/DatagramSocket.h"
#include "Poco/Net/NetworkInterface.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API MulticastSocket: public DatagramSocket
@@ -137,7 +132,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_MulticastSocket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MultipartReader.h
//
// $Id: //poco/1.1.0/Net/include/Net/MultipartReader.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MultipartReader.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,25 +40,19 @@
#define Net_MultipartReader_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_BufferedStreamBuf_INCLUDED
#include "Foundation/BufferedStreamBuf.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/BufferedStreamBuf.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class MessageHeader;
class Net_API MultipartStreamBuf: public Foundation::BufferedStreamBuf
class Net_API MultipartStreamBuf: public Poco::BufferedStreamBuf
/// This is the streambuf class used for reading from a multipart message stream.
{
public:
@@ -115,7 +109,7 @@ class Net_API MultipartReader
/// To split a multipart message into its parts,
/// do the following:
/// - Create a MultipartReader object, passing it
// an input stream and optionally a boundary string.
/// an input stream and optionally a boundary string.
/// - while hasNextPart() returns true, call nextPart()
/// and read the part from stream().
{
@@ -178,7 +172,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_MultipartReader_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// MultipartWriter.h
//
// $Id: //poco/1.1.0/Net/include/Net/MultipartWriter.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/MultipartWriter.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,16 +40,12 @@
#define Net_MultipartWriter_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class MessageHeader;
@@ -128,7 +124,7 @@ inline std::ostream& MultipartWriter::stream()
}
Net_END
} } // namespace Poco::Net
#endif // Net_MultipartWriter_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// NameValueCollection.h
//
// $Id: //poco/1.1.0/Net/include/Net/NameValueCollection.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/NameValueCollection.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,19 +40,13 @@
#define Net_NameValueCollection_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_String_INCLUDED
#include "Foundation/String.h"
#endif
#ifndef STD_MAP_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/String.h"
#include <map>
#define STD_MAP_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API NameValueCollection
@@ -69,7 +63,7 @@ public:
{
bool operator() (const std::string& s1, const std::string& s2) const
{
return Foundation::icompare(s1, s2) < 0;
return Poco::icompare(s1, s2) < 0;
}
};
@@ -108,6 +102,10 @@ public:
///
/// Throws a NotFoundException if the name-value pair does not exist.
const std::string& get(const std::string& name, const std::string& defaultValue) const;
/// Returns the value of the first name-value pair with the given name.
/// If no value with the given name has been found, the defaultValue is returned.
bool has(const std::string& name) const;
/// Returns true if there is at least one name-value pair
/// with the given name.
@@ -151,7 +149,7 @@ inline void swap(NameValueCollection& nvc1, NameValueCollection& nvc2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_NameValueCollection_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// Net.h
//
// $Id: //poco/1.1.0/Net/include/Net/Net.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/Net.h#1 $
//
// Library: Net
// Package: NetCore
@@ -42,16 +42,7 @@
#define Net_Net_INCLUDED
#ifndef Foundation_Foundation_INCLUDED
#include "Foundation/Foundation.h"
#endif
//
// Macros to declare the Net namespace
//
#define Net_BEGIN namespace Net {
#define Net_END }
#include "Poco/Foundation.h"
//
@@ -62,7 +53,7 @@
// Net_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
//
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(POCO_DLL)
#if defined(_WIN32) && defined(POCO_DLL)
#if defined(Net_EXPORTS)
#define Net_API __declspec(dllexport)
#else

View File

@@ -1,7 +1,7 @@
//
// NetException.h
//
// $Id: //poco/1.1.0/Net/include/Net/NetException.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/NetException.h#1 $
//
// Library: Net
// Package: NetCore
@@ -40,18 +40,15 @@
#define Net_NetException_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_Exception_INCLUDED
#include "Foundation/Exception.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Exception.h"
Net_BEGIN
namespace Poco {
namespace Net {
POCO_DECLARE_EXCEPTION(Net_API, NetException, Foundation::IOException)
POCO_DECLARE_EXCEPTION(Net_API, NetException, Poco::IOException)
POCO_DECLARE_EXCEPTION(Net_API, InvalidAddressException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, ServiceNotFoundException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, ConnectionAbortedException, NetException)
@@ -65,12 +62,14 @@ POCO_DECLARE_EXCEPTION(Net_API, MessageException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException)
POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException)
POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException)
POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException)
POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException)
Net_END
} } // namespace Poco::Net
#endif // Net_NetException_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// NetworkInterface.h
//
// $Id: //poco/1.1.0/Net/include/Net/NetworkInterface.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/NetworkInterface.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,22 +40,14 @@
#define Net_NetworkInterface_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_IPAddress_INCLUDED
#include "Net/IPAddress.h"
#endif
#ifndef Foundation_Mutex_INCLUDED
#include "Foundation/Mutex.h"
#endif
#ifndef STD_VECTOR_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/IPAddress.h"
#include "Poco/Mutex.h"
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API NetworkInterface
@@ -150,7 +142,7 @@ private:
IPAddress _address;
int _index;
static Foundation::FastMutex _mutex;
static Poco::FastMutex _mutex;
};
@@ -187,7 +179,7 @@ inline bool NetworkInterface::supportsIPv6() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_NetworkInterface_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// NullPartHandler.h
//
// $Id: //poco/1.1.0/Net/include/Net/NullPartHandler.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/NullPartHandler.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,15 +40,12 @@
#define Net_NullPartHandler_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_PartHandler_INCLUDED
#include "Net/PartHandler.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/PartHandler.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API NullPartHandler: public PartHandler
@@ -66,7 +63,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_NullPartHandler_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// POP3ClientSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/POP3ClientSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/POP3ClientSession.h#1 $
//
// Library: Net
// Package: Mail
@@ -40,25 +40,15 @@
#define Net_POP3ClientSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_DialogSocket_INCLUDED
#include "Net/DialogSocket.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/DialogSocket.h"
#include "Poco/Timespan.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
#ifndef STD_VECTOR_INCLUDED
#include <vector>
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class MessageHeader;
@@ -91,17 +81,17 @@ public:
/// the given socket, which must be connected
/// to a POP3 server.
POP3ClientSession(const std::string& host, Foundation::UInt16 port = POP3_PORT);
POP3ClientSession(const std::string& host, Poco::UInt16 port = POP3_PORT);
/// Creates the POP3ClientSession using a socket connected
/// to the given host and port.
virtual ~POP3ClientSession();
/// Destroys the SMTPClientSession.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout for socket read operations.
Foundation::Timespan getTimeout() const;
Poco::Timespan getTimeout() const;
/// Returns the timeout for socket read operations.
void login(const std::string& username, const std::string& password);
@@ -211,7 +201,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_POP3ClientSession_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// PartHandler.h
//
// $Id: //poco/1.1.0/Net/include/Net/PartHandler.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/PartHandler.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,16 +40,12 @@
#define Net_PartHandler_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class MessageHeader;
@@ -88,7 +84,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_PartHandler_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// PartSource.h
//
// $Id: //poco/1.1.0/Net/include/Net/PartSource.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/PartSource.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,16 +40,12 @@
#define Net_PartSource_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API PartSource
@@ -101,7 +97,7 @@ inline const std::string& PartSource::mediaType() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_PartSource_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// QuotedPrintableDecoder.h
//
// $Id: //poco/1.1.0/Net/include/Net/QuotedPrintableDecoder.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/QuotedPrintableDecoder.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,22 +40,16 @@
#define Net_QuotedPrintableDecoder_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_UnbufferedStreamBuf_INCLUDED
#include "Foundation/UnbufferedStreamBuf.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/UnbufferedStreamBuf.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API QuotedPrintableDecoderBuf: public Foundation::UnbufferedStreamBuf
class Net_API QuotedPrintableDecoderBuf: public Poco::UnbufferedStreamBuf
/// This streambuf decodes all quoted-printable (see RFC 2045)
/// encoded data read from the istream connected to it.
{
@@ -96,7 +90,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_QuotedPrintableDecoder_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// QuotedPrintableEncoder.h
//
// $Id: //poco/1.1.0/Net/include/Net/QuotedPrintableEncoder.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/QuotedPrintableEncoder.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,22 +40,16 @@
#define Net_QuotedPrintableEncoder_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_UnbufferedStreamBuf_INCLUDED
#include "Foundation/UnbufferedStreamBuf.h"
#endif
#ifndef STD_OSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/UnbufferedStreamBuf.h"
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API QuotedPrintableEncoderBuf: public Foundation::UnbufferedStreamBuf
class Net_API QuotedPrintableEncoderBuf: public Poco::UnbufferedStreamBuf
/// This streambuf encodes all data written
/// to it in quoted-printable encoding (see RFC 2045)
/// and forwards it to a connected ostream.
@@ -107,7 +101,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_QuotedPrintableEncoder_INCLUDED

View File

@@ -0,0 +1,169 @@
//
// RawSocket.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/RawSocket.h#1 $
//
// Library: Net
// Package: Sockets
// Module: RawSocket
//
// Definition of the RawSocket class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_RawSocket_INCLUDED
#define Net_RawSocket_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
namespace Poco {
namespace Net {
class Net_API RawSocket: public Socket
/// This class provides an interface to a
/// raw IP socket.
{
public:
RawSocket();
/// Creates an unconnected IPv4 raw socket.
RawSocket(IPAddress::Family family, int proto = IPPROTO_RAW);
/// Creates an unconnected raw socket.
///
/// The socket will be created for the
/// given address family.
RawSocket(const SocketAddress& address, bool reuseAddress = false);
/// Creates a raw socket and binds it
/// to the given address.
///
/// Depending on the address family, the socket
/// will be either an IPv4 or an IPv6 socket.
RawSocket(const Socket& socket);
/// Creates the RawSocket with the SocketImpl
/// from another socket. The SocketImpl must be
/// a RawSocketImpl, otherwise an InvalidArgumentException
/// will be thrown.
~RawSocket();
/// Destroys the RawSocket.
RawSocket& operator = (const Socket& socket);
/// Assignment operator.
///
/// Releases the socket's SocketImpl and
/// attaches the SocketImpl from the other socket and
/// increments the reference count of the SocketImpl.
void connect(const SocketAddress& address);
/// Restricts incoming and outgoing
/// packets to the specified address.
///
/// Cannot be used together with bind().
void bind(const SocketAddress& address, bool reuseAddress = false);
/// Bind a local address to the socket.
///
/// This is usually only done when establishing a server
/// socket.
///
/// If reuseAddress is true, sets the SO_REUSEADDR
/// socket option.
///
/// Cannot be used together with connect().
int sendBytes(const void* buffer, int length, int flags = 0);
/// Sends the contents of the given buffer through
/// the socket.
///
/// Returns the number of bytes sent, which may be
/// less than the number of bytes specified.
int receiveBytes(void* buffer, int length, int flags = 0);
/// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received.
///
/// Returns the number of bytes received.
int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0);
/// Sends the contents of the given buffer through
/// the socket to the given address.
///
/// Returns the number of bytes sent, which may be
/// less than the number of bytes specified.
int receiveFrom(void* buffer, int length, SocketAddress& address, int flags = 0);
/// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received.
/// Stores the address of the sender in address.
///
/// Returns the number of bytes received.
void setBroadcast(bool flag);
/// Sets the value of the SO_BROADCAST socket option.
///
/// Setting this flag allows sending datagrams to
/// the broadcast address.
bool getBroadcast() const;
/// Returns the value of the SO_BROADCAST socket option.
protected:
RawSocket(SocketImpl* pImpl);
/// Creates the Socket and attaches the given SocketImpl.
/// The socket takes owership of the SocketImpl.
///
/// The SocketImpl must be a StreamSocketImpl, otherwise
/// an InvalidArgumentException will be thrown.
};
//
// inlines
//
inline void RawSocket::setBroadcast(bool flag)
{
impl()->setBroadcast(flag);
}
inline bool RawSocket::getBroadcast() const
{
return impl()->getBroadcast();
}
} } // namespace Poco::Net
#endif // Net_RawSocket_INCLUDED

View File

@@ -0,0 +1,78 @@
//
// RawSocketImpl.h
//
// $Id: //poco/1.2/Net/include/Poco/Net/RawSocketImpl.h#1 $
//
// Library: Net
// Package: Sockets
// Module: RawSocketImpl
//
// Definition of the RawSocketImpl class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Net_RawSocketImpl_INCLUDED
#define Net_RawSocketImpl_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketImpl.h"
namespace Poco {
namespace Net {
class Net_API RawSocketImpl: public SocketImpl
/// This class implements a raw socket.
{
public:
RawSocketImpl();
/// Creates an unconnected IPv4 raw socket with IPPROTO_RAW.
RawSocketImpl(IPAddress::Family family, int proto = IPPROTO_RAW);
/// Creates an unconnected raw socket.
///
/// The socket will be created for the
/// given address family.
RawSocketImpl(poco_socket_t sockfd);
/// Creates a RawSocketImpl using the given native socket.
protected:
void init(int af);
void init2(int af, int proto);
~RawSocketImpl();
};
} } // namespace Poco::Net
#endif // Net_RawSocketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SMTPClientSession.h
//
// $Id: //poco/1.1.0/Net/include/Net/SMTPClientSession.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SMTPClientSession.h#1 $
//
// Library: Net
// Package: Mail
@@ -40,18 +40,13 @@
#define Net_SMTPClientSession_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_DialogSocket_INCLUDED
#include "Net/DialogSocket.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/DialogSocket.h"
#include "Poco/Timespan.h"
Net_BEGIN
namespace Poco {
namespace Net {
class MailMessage;
@@ -73,17 +68,17 @@ public:
/// the given socket, which must be connected
/// to a SMTP server.
SMTPClientSession(const std::string& host, Foundation::UInt16 port = SMTP_PORT);
SMTPClientSession(const std::string& host, Poco::UInt16 port = SMTP_PORT);
/// Creates the SMTPClientSession using a socket connected
/// to the given host and port.
virtual ~SMTPClientSession();
/// Destroys the SMTPClientSession.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout for socket read operations.
Foundation::Timespan getTimeout() const;
Poco::Timespan getTimeout() const;
/// Returns the timeout for socket read operations.
void login(const std::string& hostname);
@@ -178,7 +173,7 @@ inline bool SMTPClientSession::isPermanentNegative(int status)
}
Net_END
} } // namespace Poco::Net
#endif // Net_SMTPClientSession_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// ServerSocket.h
//
// $Id: //poco/1.1.0/Net/include/Net/ServerSocket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/ServerSocket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,18 +40,13 @@
#define Net_ServerSocket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/StreamSocket.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API ServerSocket: public Socket
@@ -79,7 +74,7 @@ public:
/// After successful construction, the server socket
/// is ready to accept connections.
ServerSocket(Foundation::UInt16 port, int backlog = 64);
ServerSocket(Poco::UInt16 port, int backlog = 64);
/// Creates a server socket, binds it
/// to the given port and puts it in listening
/// state.
@@ -107,7 +102,7 @@ public:
/// If reuseAddress is true, sets the SO_REUSEADDR
/// socket option.
virtual void bind(Foundation::UInt16 port, bool reuseAddress = false);
virtual void bind(Poco::UInt16 port, bool reuseAddress = false);
/// Bind a local port to the socket.
///
/// This is usually only done when establishing a server
@@ -155,7 +150,7 @@ protected:
};
Net_END
} } // namespace Poco::Net
#endif // Net_ServerSocket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// ServerSocketImpl.h
//
// $Id: //poco/1.1.0/Net/include/Net/ServerSocketImpl.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/ServerSocketImpl.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_ServerSocketImpl_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketImpl_INCLUDED
#include "Net/SocketImpl.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketImpl.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API ServerSocketImpl: public SocketImpl
@@ -64,7 +61,7 @@ protected:
};
Net_END
} } // namespace Poco::Net
#endif // Net_ServerSocketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// Socket.h
//
// $Id: //poco/1.1.0/Net/include/Net/Socket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/Socket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,19 +40,13 @@
#define Net_Socket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketImpl_INCLUDED
#include "Net/SocketImpl.h"
#endif
#ifndef STD_VECTOR_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketImpl.h"
#include <vector>
#define STD_VECTOR_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API Socket
@@ -116,7 +110,7 @@ public:
void close();
/// Closes the socket.
static int select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Foundation::Timespan& timeout);
static int select(SocketList& readList, SocketList& writeList, SocketList& exceptList, const Poco::Timespan& timeout);
/// Determines the status of one or more sockets,
/// using a call to select().
///
@@ -136,7 +130,7 @@ public:
/// * writeList contains those sockets ready for writing,
/// * exceptList contains those sockets with a pending error.
bool poll(const Foundation::Timespan& timeout, int mode) const;
bool poll(const Poco::Timespan& timeout, int mode) const;
/// Determines the status of the socket, using a
/// call to select().
///
@@ -170,23 +164,23 @@ public:
/// value previously set with setReceiveBufferSize(),
/// as the system is free to adjust the value.
void setSendTimeout(const Foundation::Timespan& timeout);
void setSendTimeout(const Poco::Timespan& timeout);
/// Sets the send timeout for the socket.
Foundation::Timespan getSendTimeout() const;
Poco::Timespan getSendTimeout() const;
/// Returns the send timeout for the socket.
///
/// The returned timeout may be different than the
/// timeout previously set with setSendTimeout(),
/// as the system is free to adjust the value.
void setReceiveTimeout(const Foundation::Timespan& timeout);
void setReceiveTimeout(const Poco::Timespan& timeout);
/// Sets the send timeout for the socket.
///
/// On systems that do not support SO_RCVTIMEO, a
/// workaround using poll() is provided.
Foundation::Timespan getReceiveTimeout() const;
Poco::Timespan getReceiveTimeout() const;
/// Returns the receive timeout for the socket.
///
/// The returned timeout may be different than the
@@ -205,7 +199,7 @@ public:
/// Sets the socket option specified by level and option
/// to the given integer value.
void setOption(int level, int option, const Foundation::Timespan& value);
void setOption(int level, int option, const Poco::Timespan& value);
/// Sets the socket option specified by level and option
/// to the given time value.
@@ -225,7 +219,7 @@ public:
/// Returns the value of the socket option
/// specified by level and option.
void getOption(int level, int option, Foundation::Timespan& value) const;
void getOption(int level, int option, Poco::Timespan& value) const;
/// Returns the value of the socket option
/// specified by level and option.
@@ -351,7 +345,7 @@ inline void Socket::close()
}
inline bool Socket::poll(const Foundation::Timespan& timeout, int mode) const
inline bool Socket::poll(const Poco::Timespan& timeout, int mode) const
{
return _pImpl->poll(timeout, mode);
}
@@ -387,25 +381,25 @@ inline int Socket::getReceiveBufferSize() const
}
inline void Socket::setSendTimeout(const Foundation::Timespan& timeout)
inline void Socket::setSendTimeout(const Poco::Timespan& timeout)
{
_pImpl->setSendTimeout(timeout);
}
inline Foundation::Timespan Socket::getSendTimeout() const
inline Poco::Timespan Socket::getSendTimeout() const
{
return _pImpl->getSendTimeout();
}
inline void Socket::setReceiveTimeout(const Foundation::Timespan& timeout)
inline void Socket::setReceiveTimeout(const Poco::Timespan& timeout)
{
_pImpl->setReceiveTimeout(timeout);
}
inline Foundation::Timespan Socket::getReceiveTimeout() const
inline Poco::Timespan Socket::getReceiveTimeout() const
{
return _pImpl->getReceiveTimeout();
}
@@ -429,7 +423,7 @@ inline void Socket::setOption(int level, int option, unsigned char value)
}
inline void Socket::setOption(int level, int option, const Foundation::Timespan& value)
inline void Socket::setOption(int level, int option, const Poco::Timespan& value)
{
_pImpl->setOption(level, option, value);
}
@@ -459,7 +453,7 @@ inline void Socket::getOption(int level, int option, unsigned char& value) const
}
inline void Socket::getOption(int level, int option, Foundation::Timespan& value) const
inline void Socket::getOption(int level, int option, Poco::Timespan& value) const
{
_pImpl->getOption(level, option, value);
}
@@ -589,7 +583,7 @@ inline bool Socket::supportsIPv6()
}
Net_END
} } // namespace Poco::Net
#endif // Net_Socket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketAcceptor.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketAcceptor.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketAcceptor.h#1 $
//
// Library: Net
// Package: Reactor
@@ -40,24 +40,15 @@
#define Net_SocketAcceptor_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketNotification_INCLUDED
#include "Net/SocketNotification.h"
#endif
#ifndef Net_ServerSocket_INCLUDED
#include "Net/ServerSocket.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_Observer_INCLUDED
#include "Foundation/Observer.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Observer.h"
Net_BEGIN
namespace Poco {
namespace Net {
template <class ServiceHandler>
@@ -129,7 +120,7 @@ public:
/// The overriding method must call the baseclass implementation first.
{
_pReactor = &reactor;
_pReactor->addEventHandler(_socket, Foundation::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
}
virtual void unregisterAcceptor()
@@ -142,7 +133,7 @@ public:
{
if (_pReactor)
{
_pReactor->removeEventHandler(_socket, Foundation::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
_pReactor->removeEventHandler(_socket, Poco::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
}
}
@@ -187,7 +178,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_SocketAcceptor_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketAddress.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketAddress.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketAddress.h#1 $
//
// Library: Net
// Package: NetCore
@@ -40,18 +40,13 @@
#define Net_SocketAddress_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketDefs_INCLUDED
#include "Net/SocketDefs.h"
#endif
#ifndef Net_IPAddress_INCLUDED
#include "Net/IPAddress.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/IPAddress.h"
Net_BEGIN
namespace Poco {
namespace Net {
class IPAddress;
@@ -68,10 +63,10 @@ public:
SocketAddress();
/// Creates a wildcard (all zero) IPv4 SocketAddress.
SocketAddress(const IPAddress& host, Foundation::UInt16 port);
SocketAddress(const IPAddress& host, Poco::UInt16 port);
/// Creates a SocketAddress from an IP address and a port number.
SocketAddress(const std::string& host, Foundation::UInt16 port);
SocketAddress(const std::string& host, Poco::UInt16 port);
/// Creates a SocketAddress from an IP address and a port number.
///
/// The IP address must either be a domain name, or it must
@@ -86,6 +81,17 @@ public:
///
/// The given port must either be a decimal port number, or
/// a service name.
explicit SocketAddress(const std::string& hostAndPort);
/// Creates a SocketAddress from an IP address or host name and a
/// port number/service name. Host name/address and port number must
/// be separated by a colon. In case of an IPv6 address,
/// the address part must be enclosed in brackets.
///
/// Examples:
/// 192.168.1.10:80
/// [::FFFF:192.168.1.120]:2040
/// www.appinf.com:8080
SocketAddress(const SocketAddress& addr);
/// Creates a SocketAddress by copying another one.
@@ -105,7 +111,7 @@ public:
IPAddress host() const;
/// Returns the host IP address.
Foundation::UInt16 port() const;
Poco::UInt16 port() const;
/// Returns the port number.
poco_socklen_t length() const;
@@ -132,9 +138,9 @@ public:
};
protected:
void init(const IPAddress& host, Foundation::UInt16 port);
void init(const std::string& host, Foundation::UInt16 port);
Foundation::UInt16 resolveService(const std::string& service);
void init(const IPAddress& host, Poco::UInt16 port);
void init(const std::string& host, Poco::UInt16 port);
Poco::UInt16 resolveService(const std::string& service);
private:
SocketAddressImpl* _pImpl;
@@ -150,7 +156,7 @@ inline void swap(SocketAddress& a1, SocketAddress& a2)
}
Net_END
} } // namespace Poco::Net
#endif // Net_SocketAddress_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketConnector.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketConnector.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketConnector.h#1 $
//
// Library: Net
// Package: Reactor
@@ -40,24 +40,15 @@
#define Net_SocketConnector_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketNotification_INCLUDED
#include "Net/SocketNotification.h"
#endif
#ifndef Net_SocketAddress_INCLUDED
#include "Net/SocketAddress.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_Observer_INCLUDED
#include "Foundation/Observer.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Observer.h"
Net_BEGIN
namespace Poco {
namespace Net {
template <class ServiceHandler>
@@ -133,9 +124,9 @@ public:
/// The overriding method must call the baseclass implementation first.
{
_pReactor = &reactor;
_pReactor->addEventHandler(_socket, Foundation::Observer<SocketConnector, ReadableNotification>(*this, &SocketConnector::onReadable));
_pReactor->addEventHandler(_socket, Foundation::Observer<SocketConnector, WritableNotification>(*this, &SocketConnector::onWritable));
_pReactor->addEventHandler(_socket, Foundation::Observer<SocketConnector, ErrorNotification>(*this, &SocketConnector::onError));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, ReadableNotification>(*this, &SocketConnector::onReadable));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, WritableNotification>(*this, &SocketConnector::onWritable));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, ErrorNotification>(*this, &SocketConnector::onError));
}
virtual void unregisterConnector()
@@ -148,9 +139,9 @@ public:
{
if (_pReactor)
{
_pReactor->removeEventHandler(_socket, Foundation::Observer<SocketConnector, ReadableNotification>(*this, &SocketConnector::onReadable));
_pReactor->removeEventHandler(_socket, Foundation::Observer<SocketConnector, WritableNotification>(*this, &SocketConnector::onWritable));
_pReactor->removeEventHandler(_socket, Foundation::Observer<SocketConnector, ErrorNotification>(*this, &SocketConnector::onError));
_pReactor->removeEventHandler(_socket, Poco::Observer<SocketConnector, ReadableNotification>(*this, &SocketConnector::onReadable));
_pReactor->removeEventHandler(_socket, Poco::Observer<SocketConnector, WritableNotification>(*this, &SocketConnector::onWritable));
_pReactor->removeEventHandler(_socket, Poco::Observer<SocketConnector, ErrorNotification>(*this, &SocketConnector::onError));
}
}
@@ -230,7 +221,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_SocketConnector_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketDefs.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketDefs.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketDefs.h#1 $
//
// Library: Net
// Package: NetCore

View File

@@ -1,7 +1,7 @@
//
// SocketImpl.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketImpl.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketImpl.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,27 +40,18 @@
#define Net_SocketImpl_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketDefs_INCLUDED
#include "Net/SocketDefs.h"
#endif
#ifndef Net_SocketAddress_INCLUDED
#include "Net/SocketAddress.h"
#endif
#ifndef Foundation_RefCountedObject_INCLUDED
#include "Foundation/RefCountedObject.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/RefCountedObject.h"
#include "Poco/Timespan.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API SocketImpl: public Foundation::RefCountedObject
class Net_API SocketImpl: public Poco::RefCountedObject
/// This class encapsulates the Berkeley sockets API.
///
/// Subclasses implement specific socket types like
@@ -96,7 +87,7 @@ public:
/// connection is established. Instead, incoming and outgoing
/// packets are restricted to the specified address.
virtual void connect(const SocketAddress& address, const Foundation::Timespan& timeout);
virtual void connect(const SocketAddress& address, const Poco::Timespan& timeout);
/// Initializes the socket, sets the socket timeout and
/// establishes a connection to the TCP server at the given address.
@@ -178,7 +169,7 @@ public:
/// Returns the number of bytes available that can be read
/// without causing the socket to block.
virtual bool poll(const Foundation::Timespan& timeout, int mode);
virtual bool poll(const Poco::Timespan& timeout, int mode);
/// Determines the status of the socket, using a
/// call to select().
///
@@ -208,23 +199,23 @@ public:
/// value previously set with setReceiveBufferSize(),
/// as the system is free to adjust the value.
virtual void setSendTimeout(const Foundation::Timespan& timeout);
virtual void setSendTimeout(const Poco::Timespan& timeout);
/// Sets the send timeout for the socket.
virtual Foundation::Timespan getSendTimeout();
virtual Poco::Timespan getSendTimeout();
/// Returns the send timeout for the socket.
///
/// The returned timeout may be different than the
/// timeout previously set with setSendTimeout(),
/// as the system is free to adjust the value.
virtual void setReceiveTimeout(const Foundation::Timespan& timeout);
virtual void setReceiveTimeout(const Poco::Timespan& timeout);
/// Sets the send timeout for the socket.
///
/// On systems that do not support SO_RCVTIMEO, a
/// workaround using poll() is provided.
virtual Foundation::Timespan getReceiveTimeout();
virtual Poco::Timespan getReceiveTimeout();
/// Returns the receive timeout for the socket.
///
/// The returned timeout may be different than the
@@ -249,7 +240,7 @@ public:
/// Sets the socket option specified by level and option
/// to the given integer value.
void setOption(int level, int option, const Foundation::Timespan& value);
void setOption(int level, int option, const Poco::Timespan& value);
/// Sets the socket option specified by level and option
/// to the given time value.
@@ -273,7 +264,7 @@ public:
/// Returns the value of the socket option
/// specified by level and option.
void getOption(int level, int option, Foundation::Timespan& value);
void getOption(int level, int option, Poco::Timespan& value);
/// Returns the value of the socket option
/// specified by level and option.
@@ -415,7 +406,7 @@ private:
poco_socket_t _sockfd;
#if defined(POCO_BROKEN_TIMEOUTS)
Foundation::Timespan _recvTimeout;
Poco::Timespan _recvTimeout;
#endif
friend class Socket;
@@ -454,7 +445,7 @@ inline void SocketImpl::invalidate()
}
Net_END
} } // namespace Poco::Net
#endif // Net_SocketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketNotification.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketNotification.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketNotification.h#1 $
//
// Library: Net
// Package: Reactor
@@ -40,24 +40,19 @@
#define Net_SocketNotification_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#ifndef Foundation_Notification_INCLUDED
#include "Foundation/Notification.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
#include "Poco/Notification.h"
Net_BEGIN
namespace Poco {
namespace Net {
class SocketReactor;
class Net_API SocketNotification: public Foundation::Notification
class Net_API SocketNotification: public Poco::Notification
/// The base class for all notifications generated by
/// the SocketReactor.
{
@@ -161,7 +156,7 @@ inline Socket& SocketNotification::socket()
}
Net_END
} } // namespace Poco::Net
#endif // Net_SocketNotification_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketNotifier.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketNotifier.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketNotifier.h#1 $
//
// Library: Net
// Package: Reactor
@@ -40,28 +40,16 @@
#define Net_SocketNotifier_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#ifndef Foundation_RefCountedObject_INCLUDED
#include "Foundation/RefCountedObject.h"
#endif
#ifndef Foundation_NotificationCenter_INCLUDED
#include "Foundation/NotificationCenter.h"
#endif
#ifndef Foundation_Observer_INCLUDED
#include "Foundation/Observer.h"
#endif
#ifndef STD_SET_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
#include "Poco/RefCountedObject.h"
#include "Poco/NotificationCenter.h"
#include "Poco/Observer.h"
#include <set>
#define STD_SET_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Socket;
@@ -69,7 +57,7 @@ class SocketReactor;
class SocketNotification;
class Net_API SocketNotifier: public Foundation::RefCountedObject
class Net_API SocketNotifier: public Poco::RefCountedObject
/// This class is used internally by SocketReactor
/// to notify registered event handlers of socket events.
{
@@ -77,10 +65,10 @@ public:
SocketNotifier(const Socket& socket);
/// Creates the SocketNotifier for the given socket.
void addObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer);
void addObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer);
/// Adds the given observer.
void removeObserver(SocketReactor* pReactor, const Foundation::AbstractObserver& observer);
void removeObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer);
/// Removes the given observer.
bool accepts(SocketNotification* pNotification);
@@ -97,10 +85,11 @@ protected:
/// Destroys the SocketNotifier.
private:
typedef std::multiset<SocketNotification*> EventSet;
EventSet _events;
Foundation::NotificationCenter _nc;
Socket _socket;
typedef std::multiset<SocketNotification*> EventSet;
EventSet _events;
Poco::NotificationCenter _nc;
Socket _socket;
};
@@ -119,7 +108,7 @@ inline bool SocketNotifier::hasObservers() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_SocketNotifier_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketReactor.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketReactor.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketReactor.h#1 $
//
// Library: Net
// Package: Reactor
@@ -40,31 +40,17 @@
#define Net_SocketReactor_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#ifndef Foundation_Runnable_INCLUDED
#include "Foundation/Runnable.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#ifndef Foundation_Observer_INCLUDED
#include "Foundation/Observer.h"
#endif
#ifndef Foundation_AutoPtr_INCLUDED
#include "Foundation/AutoPtr.h"
#endif
#ifndef STD_MAP_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
#include "Poco/Runnable.h"
#include "Poco/Timespan.h"
#include "Poco/Observer.h"
#include "Poco/AutoPtr.h"
#include <map>
#define STD_MAP_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Socket;
@@ -72,7 +58,7 @@ class SocketNotification;
class SocketNotifier;
class Net_API SocketReactor: public Foundation::Runnable
class Net_API SocketReactor: public Poco::Runnable
/// This class, which is part of the Reactor pattern,
/// implements the "Initiation Dispatcher".
///
@@ -137,7 +123,7 @@ public:
SocketReactor();
/// Creates the SocketReactor.
SocketReactor(const Foundation::Timespan& timeout);
SocketReactor(const Poco::Timespan& timeout);
/// Creates the SocketReactor, using the given timeout.
virtual ~SocketReactor();
@@ -153,7 +139,7 @@ public:
/// The reactor will be stopped when the next event
/// (including a timeout event) occurs.
void setTimeout(const Foundation::Timespan& timeout);
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout.
///
/// If no other event occurs for the given timeout
@@ -164,21 +150,21 @@ public:
/// The timeout is passed to the Socket::select()
/// method.
const Foundation::Timespan& getTimeout() const;
const Poco::Timespan& getTimeout() const;
/// Returns the timeout.
void addEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer);
void addEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
/// Registers an event handler with the SocketReactor.
///
/// Usage:
/// Foundation::Observer<MyEventHandler, SocketNotification> obs(*this, &MyEventHandler::handleMyEvent);
/// Poco::Observer<MyEventHandler, SocketNotification> obs(*this, &MyEventHandler::handleMyEvent);
/// reactor.addEventHandler(obs);
void removeEventHandler(const Socket& socket, const Foundation::AbstractObserver& observer);
void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
/// Unregisters an event handler with the SocketReactor.
///
/// Usage:
/// Foundation::Observer<MyEventHandler, SocketNotification> obs(*this, &MyEventHandler::handleMyEvent);
/// Poco::Observer<MyEventHandler, SocketNotification> obs(*this, &MyEventHandler::handleMyEvent);
/// reactor.removeEventHandler(obs);
protected:
@@ -204,8 +190,8 @@ protected:
/// Dispatches the given notification to all observers.
private:
typedef Foundation::AutoPtr<SocketNotifier> NotifierPtr;
typedef Foundation::AutoPtr<SocketNotification> NotificationPtr;
typedef Poco::AutoPtr<SocketNotifier> NotifierPtr;
typedef Poco::AutoPtr<SocketNotification> NotificationPtr;
typedef std::map<Socket, NotifierPtr> EventHandlerMap;
void dispatch(NotifierPtr& pNotifier, SocketNotification* pNotification);
@@ -215,21 +201,21 @@ private:
DEFAULT_TIMEOUT = 250000
};
bool _stop;
Foundation::Timespan _timeout;
EventHandlerMap _handlers;
NotificationPtr _pReadableNotification;
NotificationPtr _pWritableNotification;
NotificationPtr _pErrorNotification;
NotificationPtr _pTimeoutNotification;
NotificationPtr _pShutdownNotification;
Foundation::FastMutex _mutex;
bool _stop;
Poco::Timespan _timeout;
EventHandlerMap _handlers;
NotificationPtr _pReadableNotification;
NotificationPtr _pWritableNotification;
NotificationPtr _pErrorNotification;
NotificationPtr _pTimeoutNotification;
NotificationPtr _pShutdownNotification;
Poco::FastMutex _mutex;
friend class SocketNotifier;
};
Net_END
} } // namespace Poco::Net
#endif // Net_SocketReactor_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// SocketStream.h
//
// $Id: //poco/1.1.0/Net/include/Net/SocketStream.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/SocketStream.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,32 +40,21 @@
#define Net_SocketStream_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_BufferedBidirectionalStreamBuf_INCLUDED
#include "Foundation/BufferedBidirectionalStreamBuf.h"
#endif
#ifndef STD_ISTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/BufferedBidirectionalStreamBuf.h"
#include <istream>
#define STD_ISTREAM_INCLUDED
#endif
#ifndef STD_OSTREAM_INCLUDED
#include <ostream>
#define STD_OSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class StreamSocketImpl;
class Net_API SocketStreamBuf: public Foundation::BufferedBidirectionalStreamBuf
class Net_API SocketStreamBuf: public Poco::BufferedBidirectionalStreamBuf
/// This is the streambuf class used for reading from and writing to a socket.
{
public:
@@ -204,7 +193,7 @@ inline StreamSocketImpl* SocketStreamBuf::socketImpl() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_SocketStream_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// StreamSocket.h
//
// $Id: //poco/1.1.0/Net/include/Net/StreamSocket.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/StreamSocket.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_StreamSocket_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_Socket_INCLUDED
#include "Net/Socket.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/Socket.h"
Net_BEGIN
namespace Poco {
namespace Net {
class StreamSocketImpl;
@@ -93,7 +90,7 @@ public:
/// connection is established. Instead, incoming and outgoing
/// packets are restricted to the specified address.
void connect(const SocketAddress& address, const Foundation::Timespan& timeout);
void connect(const SocketAddress& address, const Poco::Timespan& timeout);
/// Initializes the socket, sets the socket timeout and
/// establishes a connection to the TCP server at the given address.
@@ -123,7 +120,13 @@ public:
/// Receives data from the socket and stores it
/// in buffer. Up to length bytes are received.
///
/// Returns the number of bytes received.
/// Returns the number of bytes received.
/// A return value of 0 means a graceful shutdown
/// of the connection from the peer.
///
/// Throws a TimeoutException if a receive timeout has
/// been set and nothing is received within that interval.
/// Throws a NetException (or a subclass) in case of other errors.
void sendUrgent(unsigned char data);
/// Sends one byte of urgent data through
@@ -134,7 +137,7 @@ public:
/// The preferred way for a socket to receive urgent data
/// is by enabling the SO_OOBINLINE option.
protected:
public:
StreamSocket(SocketImpl* pImpl);
/// Creates the Socket and attaches the given SocketImpl.
/// The socket takes owership of the SocketImpl.
@@ -147,7 +150,7 @@ protected:
};
Net_END
} } // namespace Poco::Net
#endif // Net_StreamSocket_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// StreamSocketImpl.h
//
// $Id: //poco/1.1.0/Net/include/Net/StreamSocketImpl.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/StreamSocketImpl.h#1 $
//
// Library: Net
// Package: Sockets
@@ -40,15 +40,12 @@
#define Net_StreamSocketImpl_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_SocketImpl_INCLUDED
#include "Net/SocketImpl.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketImpl.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API StreamSocketImpl: public SocketImpl
@@ -69,7 +66,7 @@ protected:
};
Net_END
} } // namespace Poco::Net
#endif // Net_StreamSocketImpl_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// StringPartSource.h
//
// $Id: //poco/1.1.0/Net/include/Net/StringPartSource.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/StringPartSource.h#1 $
//
// Library: Net
// Package: Messages
@@ -40,19 +40,13 @@
#define Net_StringPartSource_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_PartSource_INCLUDED
#include "Net/PartSource.h"
#endif
#ifndef STD_SSTREAM_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/PartSource.h"
#include <sstream>
#define STD_SSTREAM_INCLUDED
#endif
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API StringPartSource: public PartSource
@@ -87,7 +81,7 @@ private:
};
Net_END
} } // namespace Poco::Net
#endif // Net_StringPartSource_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// TCPServer.h
//
// $Id: //poco/1.1.0/Net/include/Net/TCPServer.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/TCPServer.h#1 $
//
// Library: Net
// Package: TCPServer
@@ -40,24 +40,15 @@
#define Net_TCPServer_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_ServerSocket_INCLUDED
#include "Net/ServerSocket.h"
#endif
#ifndef Foundation_Runnable_INCLUDED
#include "Foundation/Runnable.h"
#endif
#ifndef Foundation_Thread_INCLUDED
#include "Foundation/Thread.h"
#endif
#ifndef Foundation_ThreadPool_INCLUDED
#include "Foundation/ThreadPool.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Runnable.h"
#include "Poco/Thread.h"
#include "Poco/ThreadPool.h"
Net_BEGIN
namespace Poco {
namespace Net {
class TCPServerParams;
@@ -65,7 +56,7 @@ class TCPServerDispatcher;
class TCPServerConnectionFactory;
class Net_API TCPServer: public Foundation::Runnable
class Net_API TCPServer: public Poco::Runnable
/// This class implements a multithreaded TCP server.
///
/// The server uses a ServerSocket to listen for incoming
@@ -119,7 +110,7 @@ public:
///
/// News threads are taken from the default thread pool.
TCPServer(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams = 0);
TCPServer(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams = 0);
/// Creates the TCPServer, using the given ServerSocket.
///
/// The server takes ownership of the TCPServerConnectionFactory
@@ -189,12 +180,12 @@ private:
ServerSocket _socket;
TCPServerDispatcher* _pDispatcher;
Foundation::Thread _thread;
Poco::Thread _thread;
bool _stopped;
};
Net_END
} } // namespace Poco::Net
#endif // Net_TCPServer_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// TCPServerConnection.h
//
// $Id: //poco/1.1.0/Net/include/Net/TCPServerConnection.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerConnection.h#1 $
//
// Library: Net
// Package: TCPServer
@@ -40,21 +40,16 @@
#define Net_TCPServerConnection_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_Runnable_INCLUDED
#include "Foundation/Runnable.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Runnable.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API TCPServerConnection: public Foundation::Runnable
class Net_API TCPServerConnection: public Poco::Runnable
/// The abstract base class for TCP server connections
/// created by TCPServer.
///
@@ -107,7 +102,7 @@ inline StreamSocket& TCPServerConnection::socket()
}
Net_END
} } // namespace Poco::Net
#endif // Net_TCPServerConnection_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// TCPServerConnectionFactory.h
//
// $Id: //poco/1.1.0/Net/include/Net/TCPServerConnectionFactory.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerConnectionFactory.h#1 $
//
// Library: Net
// Package: TCPServer
@@ -40,15 +40,12 @@
#define Net_TCPServerConnectionFactory_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_TCPServerConnection_INCLUDED
#include "Net/TCPServerConnection.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/TCPServerConnection.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API TCPServerConnectionFactory
@@ -105,7 +102,7 @@ public:
};
Net_END
} } // namespace Poco::Net
#endif // Net_TCPServerConnectionFactory_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// TCPServerDispatcher.h
//
// $Id: //poco/1.1.0/Net/include/Net/TCPServerDispatcher.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerDispatcher.h#1 $
//
// Library: Net
// Package: TCPServer
@@ -40,39 +40,28 @@
#define Net_TCPServerDispatcher_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Net_StreamSocket_INCLUDED
#include "Net/StreamSocket.h"
#endif
#ifndef Foundation_Runnable_INCLUDED
#include "Foundation/Runnable.h"
#endif
#ifndef Foundation_NotificationQueue_INCLUDED
#include "Foundation/NotificationQueue.h"
#endif
#ifndef Foundation_ThreadPool_INCLUDED
#include "Foundation/ThreadPool.h"
#endif
#ifndef Foundation_Mutex_INCLUDED
#include "Foundation/Mutex.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Runnable.h"
#include "Poco/NotificationQueue.h"
#include "Poco/ThreadPool.h"
#include "Poco/Mutex.h"
Net_BEGIN
namespace Poco {
namespace Net {
class TCPServerParams;
class TCPServerConnectionFactory;
class Net_API TCPServerDispatcher: public Foundation::Runnable
class Net_API TCPServerDispatcher: public Poco::Runnable
/// A helper class for TCPServer that dispatches
/// connections to server connection threads.
{
public:
TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Foundation::ThreadPool& threadPool, TCPServerParams* pParams);
TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, TCPServerParams* pParams);
/// Creates the TCPServerDispatcher.
///
/// The dispatcher takes ownership of the TCPServerParams object.
@@ -134,16 +123,16 @@ private:
int _rc;
TCPServerParams* _pParams;
int _currentThreads;
int _totalConnections;
int _currentConnections;
int _maxConcurrentConnections;
int _refusedConnections;
int _currentThreads;
int _totalConnections;
int _currentConnections;
int _maxConcurrentConnections;
int _refusedConnections;
bool _stopped;
Foundation::NotificationQueue _queue;
TCPServerConnectionFactory* _pConnectionFactory;
Foundation::ThreadPool& _threadPool;
mutable Foundation::FastMutex _mutex;
Poco::NotificationQueue _queue;
TCPServerConnectionFactory* _pConnectionFactory;
Poco::ThreadPool& _threadPool;
mutable Poco::FastMutex _mutex;
};
@@ -156,7 +145,7 @@ inline const TCPServerParams& TCPServerDispatcher::params() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_TCPServerDispatcher_INCLUDED

View File

@@ -1,7 +1,7 @@
//
// TCPServerParams.h
//
// $Id: //poco/1.1.0/Net/include/Net/TCPServerParams.h#2 $
// $Id: //poco/1.2/Net/include/Poco/Net/TCPServerParams.h#1 $
//
// Library: Net
// Package: TCPServer
@@ -40,21 +40,16 @@
#define Net_TCPServerParams_INCLUDED
#ifndef Net_Net_INCLUDED
#include "Net/Net.h"
#endif
#ifndef Foundation_RefCountedObject_INCLUDED
#include "Foundation/RefCountedObject.h"
#endif
#ifndef Foundation_Timespan_INCLUDED
#include "Foundation/Timespan.h"
#endif
#include "Poco/Net/Net.h"
#include "Poco/RefCountedObject.h"
#include "Poco/Timespan.h"
Net_BEGIN
namespace Poco {
namespace Net {
class Net_API TCPServerParams: public Foundation::RefCountedObject
class Net_API TCPServerParams: public Poco::RefCountedObject
/// This class is used to specify parameters to both the
/// TCPServer, as well as to TCPServerDispatcher objects.
///
@@ -69,13 +64,13 @@ public:
/// - maxThreads: 0
/// - maxQueued: 64
void setThreadIdleTime(const Foundation::Timespan& idleTime);
void setThreadIdleTime(const Poco::Timespan& idleTime);
/// Sets the maximum idle time for a thread before
/// it is terminated.
///
/// The default idle time is 10 seconds;
const Foundation::Timespan& getThreadIdleTime() const;
const Poco::Timespan& getThreadIdleTime() const;
/// Returns the maximum thread idle time.
void setMaxQueued(int count);
@@ -112,7 +107,7 @@ protected:
/// Destroys the TCPServerParams.
private:
Foundation::Timespan _threadIdleTime;
Poco::Timespan _threadIdleTime;
int _maxThreads;
int _maxQueued;
};
@@ -121,7 +116,7 @@ private:
//
// inlines
//
inline const Foundation::Timespan& TCPServerParams::getThreadIdleTime() const
inline const Poco::Timespan& TCPServerParams::getThreadIdleTime() const
{
return _threadIdleTime;
}
@@ -139,7 +134,7 @@ inline int TCPServerParams::getMaxQueued() const
}
Net_END
} } // namespace Poco::Net
#endif // Net_TCPServerParams_INCLUDED

View File

@@ -1,7 +1,7 @@
#
# sample.vmsbuild
#
# $Id: //poco/1.1.0/Net/samples/EchoServer/EchoServer.vmsbuild#1 $
# $Id: //poco/1.2/Net/samples/EchoServer/EchoServer.vmsbuild#1 $
#
EXE=EchoServer
EchoServer

View File

@@ -1,7 +1,7 @@
#
# Makefile
#
# $Id: //poco/1.1.0/Net/samples/EchoServer/Makefile#1 $
# $Id: //poco/1.2/Net/samples/EchoServer/Makefile#1 $
#
# Makefile for Poco EchoServer
#
@@ -12,6 +12,6 @@ objects = EchoServer
target = EchoServer
target_version = 1
target_libs = PocoFoundation PocoXML PocoNet PocoUtil
target_libs = PocoUtil PocoNet PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/exec

View File

@@ -1,7 +1,7 @@
//
// EchoServer.cpp
//
// $Id: //poco/1.1.0/Net/samples/EchoServer/src/EchoServer.cpp#2 $
// $Id: //poco/1.2/Net/samples/EchoServer/src/EchoServer.cpp#1 $
//
// This sample demonstrates the SocketReactor and SocketAcceptor classes.
//
@@ -32,34 +32,34 @@
//
#include "Net/SocketReactor.h"
#include "Net/SocketAcceptor.h"
#include "Net/SocketNotification.h"
#include "Net/StreamSocket.h"
#include "Net/ServerSocket.h"
#include "Foundation/Observer.h"
#include "Foundation/Exception.h"
#include "Foundation/Thread.h"
#include "Util/ServerApplication.h"
#include "Util/Option.h"
#include "Util/OptionSet.h"
#include "Util/HelpFormatter.h"
#include "Poco/Net/SocketReactor.h"
#include "Poco/Net/SocketAcceptor.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Observer.h"
#include "Poco/Exception.h"
#include "Poco/Thread.h"
#include "Poco/Util/ServerApplication.h"
#include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h"
#include "Poco/Util/HelpFormatter.h"
#include <iostream>
using Net::SocketReactor;
using Net::SocketAcceptor;
using Net::ReadableNotification;
using Net::ShutdownNotification;
using Net::ServerSocket;
using Net::StreamSocket;
using Foundation::Observer;
using Foundation::Thread;
using Util::ServerApplication;
using Util::Application;
using Util::Option;
using Util::OptionSet;
using Util::HelpFormatter;
using Poco::Net::SocketReactor;
using Poco::Net::SocketAcceptor;
using Poco::Net::ReadableNotification;
using Poco::Net::ShutdownNotification;
using Poco::Net::ServerSocket;
using Poco::Net::StreamSocket;
using Poco::Observer;
using Poco::Thread;
using Poco::Util::ServerApplication;
using Poco::Util::Application;
using Poco::Util::Option;
using Poco::Util::OptionSet;
using Poco::Util::HelpFormatter;
class EchoServiceHandler
@@ -119,7 +119,7 @@ private:
};
class EchoServer: public Util::ServerApplication
class EchoServer: public Poco::Util::ServerApplication
/// The main application class.
///
/// This class handles command-line arguments and

View File

@@ -0,0 +1,10 @@
# This is a sample configuration file for HTTPFormServer
logging.loggers.root.channel.class = ConsoleChannel
logging.loggers.app.name = Application
logging.loggers.app.channel = c1
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = [%p] %t
logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
HTTPFormServer.port = 9980

View File

@@ -0,0 +1,8 @@
#
# sample.vmsbuild
#
# $Id: //poco/1.2/Net/samples/HTTPFormServer/HTTPFormServer.vmsbuild#1 $
#
EXE=HTTPFormServer
HTTPFormServer
<SourceFilesHere>

View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="HTTPFormServer"
ProjectGUID="{45A054E6-44EC-4943-809A-BA8B2A25DA21}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib"
OutputFile="bin/HTTPFormServerd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/HTTPFormServerd.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib"
OutputFile="bin/HTTPFormServer.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Configuration Files"
Filter="">
<File
RelativePath=".\HTTPFormServer.properties">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\HTTPFormServer.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="HTTPFormServer"
ProjectGUID="{5363487F-1F23-4F9E-B6A7-5471B0F2373F}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib"
OutputFile="bin/HTTPFormServerd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin/HTTPFormServerd.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib"
OutputFile="bin/HTTPFormServer.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Configuration Files"
>
<File
RelativePath=".\HTTPFormServer.properties"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\HTTPFormServer.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,17 @@
#
# Makefile
#
# $Id: //poco/1.2/Net/samples/HTTPFormServer/Makefile#1 $
#
# Makefile for Poco HTTPFormServer
#
include $(POCO_BASE)/build/rules/global
objects = HTTPFormServer
target = HTTPFormServer
target_version = 1
target_libs = PocoUtil PocoNet PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/exec

View File

@@ -0,0 +1,326 @@
//
// HTTPFormServer.cpp
//
// $Id: //poco/Main/Net/samples/HTTPFormServer/src/HTTPFormServer.cpp#5 $
//
// This sample demonstrates the HTTPServer and HTMLForm classes.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "Poco/Net/HTTPServer.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Net/HTMLForm.h"
#include "Poco/Net/PartHandler.h"
#include "Poco/Net/MessageHeader.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/CountingStream.h"
#include "Poco/NullStream.h"
#include "Poco/StreamCopier.h"
#include "Poco/Exception.h"
#include "Poco/Util/ServerApplication.h"
#include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h"
#include "Poco/Util/HelpFormatter.h"
#include <iostream>
using Poco::Net::ServerSocket;
using Poco::Net::HTTPRequestHandler;
using Poco::Net::HTTPRequestHandlerFactory;
using Poco::Net::HTTPServer;
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
using Poco::Net::HTTPServerParams;
using Poco::Net::MessageHeader;
using Poco::Net::HTMLForm;
using Poco::Net::NameValueCollection;
using Poco::Util::ServerApplication;
using Poco::Util::Application;
using Poco::Util::Option;
using Poco::Util::OptionSet;
using Poco::Util::HelpFormatter;
using Poco::CountingInputStream;
using Poco::NullOutputStream;
using Poco::StreamCopier;
class MyPartHandler: public Poco::Net::PartHandler
{
public:
MyPartHandler():
_length(0)
{
}
void handlePart(const MessageHeader& header, std::istream& stream)
{
_type = header.get("Content-Type", "(unspecified)");
if (header.has("Content-Disposition"))
{
std::string disp;
NameValueCollection params;
MessageHeader::splitParameters(header["Content-Disposition"], disp, params);
_name = params.get("name", "(unnamed)");
_fileName = params.get("filename", "(unnamed)");
}
CountingInputStream istr(stream);
NullOutputStream ostr;
StreamCopier::copyStream(istr, ostr);
_length = istr.chars();
}
int length() const
{
return _length;
}
const std::string& name() const
{
return _name;
}
const std::string& fileName() const
{
return _fileName;
}
const std::string& contentType() const
{
return _type;
}
private:
int _length;
std::string _type;
std::string _name;
std::string _fileName;
};
class FormRequestHandler: public HTTPRequestHandler
/// Return a HTML document with the current date and time.
{
public:
FormRequestHandler()
{
}
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
Application& app = Application::instance();
app.logger().information("Request from " + request.clientAddress().toString());
MyPartHandler partHandler;
HTMLForm form(request, request.stream(), partHandler);
response.setChunkedTransferEncoding(true);
response.setContentType("text/html");
std::ostream& ostr = response.send();
ostr <<
"<html>\n"
"<head>\n"
"<title>POCO Form Server Sample</title>\n"
"</head>\n"
"<body>\n"
"<h1>POCO Form Server Sample</h1>\n"
"<h2>GET Form</h2>\n"
"<form method=\"GET\" action=\"/form\">\n"
"<input type=\"text\" name=\"text\" size=\"31\">\n"
"<input type=\"submit\" value=\"GET\">\n"
"</form>\n"
"<h2>POST Form</h2>\n"
"<form method=\"POST\" action=\"/form\">\n"
"<input type=\"text\" name=\"text\" size=\"31\">\n"
"<input type=\"submit\" value=\"POST\">\n"
"</form>\n"
"<h2>File Upload</h2>\n"
"<form method=\"POST\" action=\"/form\" enctype=\"multipart/form-data\">\n"
"<input type=\"file\" name=\"file\" size=\"31\"> \n"
"<input type=\"submit\" value=\"Upload\">\n"
"</form>\n";
ostr << "<h2>Request</h2><p>\n";
ostr << "Method: " << request.getMethod() << "<br>\n";
ostr << "URI: " << request.getURI() << "<br>\n";
NameValueCollection::ConstIterator it = request.begin();
NameValueCollection::ConstIterator end = request.end();
for (; it != end; ++it)
{
ostr << it->first << ": " << it->second << "<br>\n";
}
ostr << "</p>";
if (!form.empty())
{
ostr << "<h2>Form</h2><p>\n";
it = form.begin();
end = form.end();
for (; it != end; ++it)
{
ostr << it->first << ": " << it->second << "<br>\n";
}
ostr << "</p>";
}
if (!partHandler.name().empty())
{
ostr << "<h2>Upload</h2><p>\n";
ostr << "Name: " << partHandler.name() << "<br>\n";
ostr << "File Name: " << partHandler.fileName() << "<br>\n";
ostr << "Type: " << partHandler.contentType() << "<br>\n";
ostr << "Size: " << partHandler.length() << "<br>\n";
ostr << "</p>";
}
ostr << "</body>\n";
}
};
class FormRequestHandlerFactory: public HTTPRequestHandlerFactory
{
public:
FormRequestHandlerFactory()
{
}
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
{
return new FormRequestHandler;
}
};
class HTTPFormServer: public Poco::Util::ServerApplication
/// The main application class.
///
/// This class handles command-line arguments and
/// configuration files.
/// Start the HTTPFormServer executable with the help
/// option (/help on Windows, --help on Unix) for
/// the available command line options.
///
/// To use the sample configuration file (HTTPFormServer.properties),
/// copy the file to the directory where the HTTPFormServer executable
/// resides. If you start the debug version of the HTTPFormServer
/// (HTTPFormServerd[.exe]), you must also create a copy of the configuration
/// file named HTTPFormServerd.properties. In the configuration file, you
/// can specify the port on which the server is listening (default
/// 9980) and the format of the date/Form string sent back to the client.
///
/// To test the FormServer you can use any web browser (http://localhost:9980/).
{
public:
HTTPFormServer(): _helpRequested(false)
{
}
~HTTPFormServer()
{
}
protected:
void initialize(Application& self)
{
loadConfiguration(); // load default configuration files, if present
ServerApplication::initialize(self);
}
void uninitialize()
{
ServerApplication::uninitialize();
}
void defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false));
}
void handleOption(const std::string& name, const std::string& value)
{
ServerApplication::handleOption(name, value);
if (name == "help")
_helpRequested = true;
}
void displayHelp()
{
HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS");
helpFormatter.setHeader("A web server that shows how to work with HTML forms.");
helpFormatter.format(std::cout);
}
int main(const std::vector<std::string>& args)
{
if (_helpRequested)
{
displayHelp();
}
else
{
unsigned short port = (unsigned short) config().getInt("HTTPFormServer.port", 9980);
// set-up a server socket
ServerSocket svs(port);
// set-up a HTTPServer instance
HTTPServer srv(new FormRequestHandlerFactory, svs, new HTTPServerParams);
// start the HTTPServer
srv.start();
// wait for CTRL-C or kill
waitForTerminationRequest();
// Stop the HTTPServer
srv.stop();
}
return Application::EXIT_OK;
}
private:
bool _helpRequested;
};
int main(int argc, char** argv)
{
HTTPFormServer app;
return app.run(argc, argv);
}

View File

@@ -0,0 +1,7 @@
#
# HTTPLoadTest.vmsbuild
#
# $Id: //poco/1.2/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild#1 $
#
EXE=HTTPLoadTest
HTTPLoadTest

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="HTTPLoadTest"
ProjectGUID="{455C9515-4914-49B6-93FB-C37242A6C21C}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib"
OutputFile="bin/HTTPLoadTestd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/HTTPLoadTestd.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib"
OutputFile="bin/HTTPLoadTest.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\HTTPLoadTest.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="HTTPLoadTest"
ProjectGUID="{DC23240B-5266-4486-A141-B8D6F25F7676}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib"
OutputFile="bin/HTTPLoadTestd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin/HTTPLoadTestd.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib"
OutputFile="bin/HTTPLoadTest.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\HTTPLoadTest.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Some files were not shown because too many files have changed in this diff Show More