mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
minor fixes, mostly style and documentation
This commit is contained in:
parent
68a0ff1515
commit
5692187d2d
@ -37,7 +37,6 @@ class Net_API DNS
|
|||||||
/// An internal DNS cache is used to speed up name lookups.
|
/// An internal DNS cache is used to speed up name lookups.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum HintFlag
|
enum HintFlag
|
||||||
{
|
{
|
||||||
DNS_HINT_NONE = 0,
|
DNS_HINT_NONE = 0,
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
DatagramSocket(SocketImpl* pImpl);
|
DatagramSocket(SocketImpl* pImpl);
|
||||||
/// Creates the Socket and attaches the given SocketImpl.
|
/// Creates the Socket and attaches the given SocketImpl.
|
||||||
/// The socket takes owership of the SocketImpl.
|
/// The socket takes ownership of the SocketImpl.
|
||||||
///
|
///
|
||||||
/// The SocketImpl must be a StreamSocketImpl, otherwise
|
/// The SocketImpl must be a StreamSocketImpl, otherwise
|
||||||
/// an InvalidArgumentException will be thrown.
|
/// an InvalidArgumentException will be thrown.
|
||||||
|
@ -134,7 +134,7 @@ public:
|
|||||||
void setFileType(FileType type);
|
void setFileType(FileType type);
|
||||||
/// Sets the file type for transferring files.
|
/// Sets the file type for transferring files.
|
||||||
///
|
///
|
||||||
/// Sends a TYPE command with a corresponsing argument to the
|
/// Sends a TYPE command with a corresponding argument to the
|
||||||
/// server.
|
/// server.
|
||||||
///
|
///
|
||||||
/// Throws a FTPException in case of a FTP-specific error, or a
|
/// Throws a FTPException in case of a FTP-specific error, or a
|
||||||
@ -160,7 +160,7 @@ public:
|
|||||||
|
|
||||||
void cdup();
|
void cdup();
|
||||||
/// Moves one directory up from the current working directory
|
/// Moves one directory up from the current working directory
|
||||||
/// on teh server.
|
/// on the server.
|
||||||
///
|
///
|
||||||
/// Sends a CDUP command to the server.
|
/// Sends a CDUP command to the server.
|
||||||
///
|
///
|
||||||
@ -227,7 +227,7 @@ public:
|
|||||||
std::ostream& beginUpload(const std::string& path);
|
std::ostream& beginUpload(const std::string& path);
|
||||||
/// Starts uploading the file with the given name.
|
/// Starts uploading the file with the given name.
|
||||||
/// After all data has been written to the returned stream,
|
/// After all data has been written to the returned stream,
|
||||||
/// endUpload() must be called to finish the download.
|
/// endUpload() must be called to finish the upload.
|
||||||
///
|
///
|
||||||
/// A stream for reading the file's content is returned.
|
/// A stream for reading the file's content is returned.
|
||||||
/// The stream is valid until endUpload() is called.
|
/// The stream is valid until endUpload() is called.
|
||||||
@ -258,7 +258,7 @@ public:
|
|||||||
/// The stream is valid until endList() is called.
|
/// The stream is valid until endList() is called.
|
||||||
///
|
///
|
||||||
/// Optionally, a path to a directory or file can be specified.
|
/// Optionally, a path to a directory or file can be specified.
|
||||||
/// According to the FTP prototol, if a path to a filename is
|
/// According to the FTP protocol, if a path to a filename is
|
||||||
/// given, only information for the specific file is returned.
|
/// given, only information for the specific file is returned.
|
||||||
/// If a path to a directory is given, a listing of that directory
|
/// If a path to a directory is given, a listing of that directory
|
||||||
/// is returned. If no path is given, a listing of the current
|
/// is returned. If no path is given, a listing of the current
|
||||||
|
@ -45,7 +45,7 @@ class Net_API HTTPClientSession: public HTTPSession
|
|||||||
/// specify the server's host name and port number.
|
/// specify the server's host name and port number.
|
||||||
///
|
///
|
||||||
/// Then create a HTTPRequest object, fill it accordingly,
|
/// Then create a HTTPRequest object, fill it accordingly,
|
||||||
/// and pass it as argument to the sendRequst() method.
|
/// and pass it as argument to the sendRequest() method.
|
||||||
///
|
///
|
||||||
/// sendRequest() will return an output stream that can
|
/// sendRequest() will return an output stream that can
|
||||||
/// be used to send the request body, if there is any.
|
/// be used to send the request body, if there is any.
|
||||||
|
@ -49,9 +49,13 @@ public:
|
|||||||
/// Destroys the HTTPRequestHandlerFactory.
|
/// Destroys the HTTPRequestHandlerFactory.
|
||||||
|
|
||||||
virtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) = 0;
|
virtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) = 0;
|
||||||
/// Must be overridden by sublasses.
|
/// Must be overridden by subclasses.
|
||||||
///
|
///
|
||||||
/// Creates a new request handler for the given HTTP request.
|
/// Creates a new request handler for the given HTTP request.
|
||||||
|
///
|
||||||
|
/// The method should inspect the given HTTPServerRequest object (e.g., method
|
||||||
|
/// and URI) and create an appropriate HTTPRequestHandler object to handle the
|
||||||
|
/// request.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Poco::BasicEvent<const bool> serverStopped;
|
Poco::BasicEvent<const bool> serverStopped;
|
||||||
|
@ -88,7 +88,7 @@ public:
|
|||||||
/// Returns the connection timeout for HTTP connections.
|
/// Returns the connection timeout for HTTP connections.
|
||||||
|
|
||||||
void setMaxKeepAliveRequests(int maxKeepAliveRequests);
|
void setMaxKeepAliveRequests(int maxKeepAliveRequests);
|
||||||
/// Specifies the maximun number of requests allowed
|
/// Specifies the maximum number of requests allowed
|
||||||
/// during a persistent connection. 0 means unlimited
|
/// during a persistent connection. 0 means unlimited
|
||||||
/// connections.
|
/// connections.
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
ICMPSocket(SocketImpl* pImpl);
|
ICMPSocket(SocketImpl* pImpl);
|
||||||
/// Creates the Socket and attaches the given SocketImpl.
|
/// Creates the Socket and attaches the given SocketImpl.
|
||||||
/// The socket takes owership of the SocketImpl.
|
/// The socket takes ownership of the SocketImpl.
|
||||||
///
|
///
|
||||||
/// The SocketImpl must be a ICMPSocketImpl, otherwise
|
/// The SocketImpl must be a ICMPSocketImpl, otherwise
|
||||||
/// an InvalidArgumentException will be thrown.
|
/// an InvalidArgumentException will be thrown.
|
||||||
|
@ -373,21 +373,13 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ptr pImpl() const;
|
Ptr pImpl() const;
|
||||||
|
|
||||||
void newIPv4(const void* hostAddr);
|
void newIPv4(const void* hostAddr);
|
||||||
|
|
||||||
void newIPv6(const void* hostAddr);
|
void newIPv6(const void* hostAddr);
|
||||||
|
|
||||||
void newIPv6(const void* hostAddr, Poco::UInt32 scope);
|
void newIPv6(const void* hostAddr, Poco::UInt32 scope);
|
||||||
|
|
||||||
void newIPv4(unsigned prefix);
|
void newIPv4(unsigned prefix);
|
||||||
|
|
||||||
void newIPv6(unsigned prefix);
|
void newIPv6(unsigned prefix);
|
||||||
|
|
||||||
void newIPv4();
|
void newIPv4();
|
||||||
|
|
||||||
void newIPv6();
|
void newIPv6();
|
||||||
|
|
||||||
void destruct();
|
void destruct();
|
||||||
|
|
||||||
#ifdef POCO_HAVE_ALIGNMENT
|
#ifdef POCO_HAVE_ALIGNMENT
|
||||||
@ -413,6 +405,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// inlines
|
||||||
|
//
|
||||||
inline void IPAddress::destruct()
|
inline void IPAddress::destruct()
|
||||||
{
|
{
|
||||||
#ifdef POCO_HAVE_ALIGNMENT
|
#ifdef POCO_HAVE_ALIGNMENT
|
||||||
|
@ -207,7 +207,7 @@ public:
|
|||||||
const std::string& mediaType,
|
const std::string& mediaType,
|
||||||
const std::string& filename = "");
|
const std::string& filename = "");
|
||||||
/// Returns either default StringPartSource part store or,
|
/// Returns either default StringPartSource part store or,
|
||||||
/// if the part store factory was provided during contruction,
|
/// if the part store factory was provided during construction,
|
||||||
/// the one created by PartStoreFactory.
|
/// the one created by PartStoreFactory.
|
||||||
/// Returned part store is allocated on the heap; it is caller's
|
/// Returned part store is allocated on the heap; it is caller's
|
||||||
/// responsibility to delete it after use. Typical use is handler
|
/// responsibility to delete it after use. Typical use is handler
|
||||||
|
@ -113,8 +113,8 @@ protected:
|
|||||||
|
|
||||||
class Net_API MailInputStream: public MailIOS, public std::istream
|
class Net_API MailInputStream: public MailIOS, public std::istream
|
||||||
/// This class is used for reading E-Mail messages from a
|
/// This class is used for reading E-Mail messages from a
|
||||||
/// POP3 server. All occurences of "\r\n..\r\n" are replaced with
|
/// POP3 server. All occurrences of "\r\n..\r\n" are replaced with
|
||||||
/// "\r\n.\r\n". The first occurence of "\r\n.\r\n" denotes the end
|
/// "\r\n.\r\n". The first occurrence of "\r\n.\r\n" denotes the end
|
||||||
/// of the stream.
|
/// of the stream.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
|
|
||||||
class Net_API MailOutputStream: public MailIOS, public std::ostream
|
class Net_API MailOutputStream: public MailIOS, public std::ostream
|
||||||
/// This class is used for writing E-Mail messages to a
|
/// This class is used for writing E-Mail messages to a
|
||||||
/// SMTP server. All occurences of "\r\n.\r\n" are replaced with
|
/// SMTP server. All occurrences of "\r\n.\r\n" are replaced with
|
||||||
/// "\r\n..\r\n".
|
/// "\r\n..\r\n".
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -109,7 +109,7 @@ public:
|
|||||||
/// Returns true if the type and subtype match
|
/// Returns true if the type and subtype match
|
||||||
/// the type and subtype of the given media type.
|
/// the type and subtype of the given media type.
|
||||||
/// If the MIME type is a range of types it matches
|
/// If the MIME type is a range of types it matches
|
||||||
/// any media type withing the range (e.g. "image/*" matches
|
/// any media type within the range (e.g. "image/*" matches
|
||||||
/// any image media type, "*/*" matches anything).
|
/// any image media type, "*/*" matches anything).
|
||||||
/// Matching is case insensitive.
|
/// Matching is case insensitive.
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
/// Returns true if the type and subtype match
|
/// Returns true if the type and subtype match
|
||||||
/// the given type and subtype.
|
/// the given type and subtype.
|
||||||
/// If the MIME type is a range of types it matches
|
/// If the MIME type is a range of types it matches
|
||||||
/// any media type withing the range (e.g. "image/*" matches
|
/// any media type within the range (e.g. "image/*" matches
|
||||||
/// any image media type, "*/*" matches anything).
|
/// any image media type, "*/*" matches anything).
|
||||||
/// Matching is case insensitive.
|
/// Matching is case insensitive.
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "Poco/Mutex.h"
|
#include "Poco/Mutex.h"
|
||||||
#include "Poco/Tuple.h"
|
#include "Poco/Tuple.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -122,7 +123,7 @@ public:
|
|||||||
/// Assigns another NetworkInterface.
|
/// Assigns another NetworkInterface.
|
||||||
|
|
||||||
bool operator < (const NetworkInterface& other) const;
|
bool operator < (const NetworkInterface& other) const;
|
||||||
/// Operatorr less-than.
|
/// Operator less-than.
|
||||||
|
|
||||||
bool operator == (const NetworkInterface& other) const;
|
bool operator == (const NetworkInterface& other) const;
|
||||||
/// Operator equal. Compares interface indices.
|
/// Operator equal. Compares interface indices.
|
||||||
@ -149,7 +150,7 @@ public:
|
|||||||
/// Returns the interface adapter name.
|
/// Returns the interface adapter name.
|
||||||
///
|
///
|
||||||
/// On Windows platforms, this is the network adapter LUID.
|
/// On Windows platforms, this is the network adapter LUID.
|
||||||
/// The adapter name is used by some Windows Net APIs like Dhcp.
|
/// The adapter name is used by some Windows Net APIs like DHCP.
|
||||||
///
|
///
|
||||||
/// On other platforms this is the same as name().
|
/// On other platforms this is the same as name().
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ public:
|
|||||||
/// Returns the broadcast address for this network interface.
|
/// Returns the broadcast address for this network interface.
|
||||||
|
|
||||||
const IPAddress& destAddress(unsigned index = 0) const;
|
const IPAddress& destAddress(unsigned index = 0) const;
|
||||||
/// Returns the IPv4 point-to-point destiation address for this network interface.
|
/// Returns the IPv4 point-to-point destination address for this network interface.
|
||||||
|
|
||||||
const MACAddress& macAddress() const;
|
const MACAddress& macAddress() const;
|
||||||
/// Returns MAC (Media Access Control) address for the interface.
|
/// Returns MAC (Media Access Control) address for the interface.
|
||||||
@ -235,6 +236,9 @@ public:
|
|||||||
/// The ipVersion argument can be used to specify whether
|
/// The ipVersion argument can be used to specify whether
|
||||||
/// an IPv4 (IPv4_ONLY) or IPv6 (IPv6_ONLY) interface is required,
|
/// an IPv4 (IPv4_ONLY) or IPv6 (IPv6_ONLY) interface is required,
|
||||||
/// or whether the caller does not care (IPv4_OR_IPv6).
|
/// or whether the caller does not care (IPv4_OR_IPv6).
|
||||||
|
///
|
||||||
|
/// Throws an InterfaceNotFoundException if an interface
|
||||||
|
/// with the give name does not exist.
|
||||||
|
|
||||||
static NetworkInterface forAddress(const IPAddress& address);
|
static NetworkInterface forAddress(const IPAddress& address);
|
||||||
/// Returns the NetworkInterface for the given IP address.
|
/// Returns the NetworkInterface for the given IP address.
|
||||||
@ -342,7 +346,7 @@ inline bool NetworkInterface::operator == (const NetworkInterface& other) const
|
|||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|
||||||
|
|
||||||
Net_API std::ostream& operator<<(std::ostream& os, const Poco::Net::NetworkInterface::MACAddress& mac);
|
Net_API std::ostream& operator << (std::ostream& ostr, const Poco::Net::NetworkInterface::MACAddress& addr);
|
||||||
|
|
||||||
|
|
||||||
#endif // POCO_NET_HAS_INTERFACE
|
#endif // POCO_NET_HAS_INTERFACE
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
RawSocket(SocketImpl* pImpl);
|
RawSocket(SocketImpl* pImpl);
|
||||||
/// Creates the Socket and attaches the given SocketImpl.
|
/// Creates the Socket and attaches the given SocketImpl.
|
||||||
/// The socket takes owership of the SocketImpl.
|
/// The socket takes ownership of the SocketImpl.
|
||||||
///
|
///
|
||||||
/// The SocketImpl must be a StreamSocketImpl, otherwise
|
/// The SocketImpl must be a StreamSocketImpl, otherwise
|
||||||
/// an InvalidArgumentException will be thrown.
|
/// an InvalidArgumentException will be thrown.
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
SYSLOG_NTP = (12<<3), /// ntp subsystem
|
SYSLOG_NTP = (12<<3), /// ntp subsystem
|
||||||
SYSLOG_LOGAUDIT = (13<<3), /// log audit
|
SYSLOG_LOGAUDIT = (13<<3), /// log audit
|
||||||
SYSLOG_LOGALERT = (14<<3), /// log alert
|
SYSLOG_LOGALERT = (14<<3), /// log alert
|
||||||
SYSLOG_CLOCK = (15<<3), /// clock deamon
|
SYSLOG_CLOCK = (15<<3), /// clock daemon
|
||||||
SYSLOG_LOCAL0 = (16<<3), /// reserved for local use
|
SYSLOG_LOCAL0 = (16<<3), /// reserved for local use
|
||||||
SYSLOG_LOCAL1 = (17<<3), /// reserved for local use
|
SYSLOG_LOCAL1 = (17<<3), /// reserved for local use
|
||||||
SYSLOG_LOCAL2 = (18<<3), /// reserved for local use
|
SYSLOG_LOCAL2 = (18<<3), /// reserved for local use
|
||||||
|
@ -35,7 +35,7 @@ class MailMessage;
|
|||||||
|
|
||||||
class Net_API SMTPClientSession
|
class Net_API SMTPClientSession
|
||||||
/// This class implements an Simple Mail
|
/// This class implements an Simple Mail
|
||||||
/// Transfer Procotol (SMTP, RFC 2821)
|
/// Transfer Protocol (SMTP, RFC 2821)
|
||||||
/// client for sending e-mail messages.
|
/// client for sending e-mail messages.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
/// Creates a server socket.
|
/// Creates a server socket.
|
||||||
///
|
///
|
||||||
/// The server socket must be bound to
|
/// The server socket must be bound to
|
||||||
/// and address and put into listening state.
|
/// an address and put into listening state.
|
||||||
|
|
||||||
ServerSocket(const Socket& socket);
|
ServerSocket(const Socket& socket);
|
||||||
/// Creates the ServerSocket with the SocketImpl
|
/// Creates the ServerSocket with the SocketImpl
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
/// increments the reference count of the SocketImpl.
|
/// increments the reference count of the SocketImpl.
|
||||||
|
|
||||||
virtual void bind(const SocketAddress& address, bool reuseAddress = false);
|
virtual void bind(const SocketAddress& address, bool reuseAddress = false);
|
||||||
/// Bind a local address to the socket.
|
/// Binds a local address to the socket.
|
||||||
///
|
///
|
||||||
/// This is usually only done when establishing a server
|
/// This is usually only done when establishing a server
|
||||||
/// socket. TCP clients should not bind a socket to a
|
/// socket. TCP clients should not bind a socket to a
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
/// socket option.
|
/// socket option.
|
||||||
|
|
||||||
virtual void bind(Poco::UInt16 port, bool reuseAddress = false);
|
virtual void bind(Poco::UInt16 port, bool reuseAddress = false);
|
||||||
/// Bind a local port to the socket.
|
/// Binds a local port to the socket.
|
||||||
///
|
///
|
||||||
/// This is usually only done when establishing a server
|
/// This is usually only done when establishing a server
|
||||||
/// socket.
|
/// socket.
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
/// socket option.
|
/// socket option.
|
||||||
|
|
||||||
virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false);
|
virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false);
|
||||||
/// Bind a local IPv6 address to the socket.
|
/// Binds a local IPv6 address to the socket.
|
||||||
///
|
///
|
||||||
/// This is usually only done when establishing a server
|
/// This is usually only done when establishing a server
|
||||||
/// socket. TCP clients should not bind a socket to a
|
/// socket. TCP clients should not bind a socket to a
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
/// a Poco::NotImplementedException will be thrown.
|
/// a Poco::NotImplementedException will be thrown.
|
||||||
|
|
||||||
virtual void bind6(Poco::UInt16 port, bool reuseAddress = false, bool ipV6Only = false);
|
virtual void bind6(Poco::UInt16 port, bool reuseAddress = false, bool ipV6Only = false);
|
||||||
/// Bind a local IPv6 port to the socket.
|
/// Binds a local IPv6 port to the socket.
|
||||||
///
|
///
|
||||||
/// This is usually only done when establishing a server
|
/// This is usually only done when establishing a server
|
||||||
/// socket.
|
/// socket.
|
||||||
@ -135,7 +135,7 @@ public:
|
|||||||
/// for this socket.
|
/// for this socket.
|
||||||
|
|
||||||
virtual StreamSocket acceptConnection(SocketAddress& clientAddr);
|
virtual StreamSocket acceptConnection(SocketAddress& clientAddr);
|
||||||
/// Get the next completed connection from the
|
/// Gets the next completed connection from the
|
||||||
/// socket's completed connection queue.
|
/// socket's completed connection queue.
|
||||||
///
|
///
|
||||||
/// If the queue is empty, waits until a connection
|
/// If the queue is empty, waits until a connection
|
||||||
@ -147,7 +147,7 @@ public:
|
|||||||
/// The client socket's address is returned in clientAddr.
|
/// The client socket's address is returned in clientAddr.
|
||||||
|
|
||||||
virtual StreamSocket acceptConnection();
|
virtual StreamSocket acceptConnection();
|
||||||
/// Get the next completed connection from the
|
/// Gets the next completed connection from the
|
||||||
/// socket's completed connection queue.
|
/// socket's completed connection queue.
|
||||||
///
|
///
|
||||||
/// If the queue is empty, waits until a connection
|
/// If the queue is empty, waits until a connection
|
||||||
|
@ -299,7 +299,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Socket(SocketImpl* pImpl);
|
Socket(SocketImpl* pImpl);
|
||||||
/// Creates the Socket and attaches the given SocketImpl.
|
/// Creates the Socket and attaches the given SocketImpl.
|
||||||
/// The socket takes owership of the SocketImpl.
|
/// The socket takes ownership of the SocketImpl.
|
||||||
|
|
||||||
poco_socket_t sockfd() const;
|
poco_socket_t sockfd() const;
|
||||||
/// Returns the socket descriptor for this socket.
|
/// Returns the socket descriptor for this socket.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "Poco/RefCountedObject.h"
|
#include "Poco/RefCountedObject.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
namespace Net {
|
namespace Net {
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
@ -59,20 +60,15 @@ class Net_API IPv4SocketAddressImpl: public SocketAddressImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IPv4SocketAddressImpl();
|
IPv4SocketAddressImpl();
|
||||||
|
|
||||||
IPv4SocketAddressImpl(const struct sockaddr_in* addr);
|
IPv4SocketAddressImpl(const struct sockaddr_in* addr);
|
||||||
|
|
||||||
IPv4SocketAddressImpl(const void* addr, UInt16 port);
|
IPv4SocketAddressImpl(const void* addr, UInt16 port);
|
||||||
|
|
||||||
IPAddress host() const;
|
IPAddress host() const;
|
||||||
|
|
||||||
UInt16 port() const;
|
UInt16 port() const;
|
||||||
|
|
||||||
poco_socklen_t length() const;
|
poco_socklen_t length() const;
|
||||||
|
|
||||||
const struct sockaddr* addr() const;
|
const struct sockaddr* addr() const;
|
||||||
|
|
||||||
int af() const;
|
int af() const;
|
||||||
|
Family family() const;
|
||||||
|
std::string toString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct sockaddr_in _addr;
|
struct sockaddr_in _addr;
|
||||||
@ -120,19 +116,12 @@ class Net_API IPv6SocketAddressImpl: public SocketAddressImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IPv6SocketAddressImpl(const struct sockaddr_in6* addr);
|
IPv6SocketAddressImpl(const struct sockaddr_in6* addr);
|
||||||
|
|
||||||
IPv6SocketAddressImpl(const void* addr, UInt16 port);
|
IPv6SocketAddressImpl(const void* addr, UInt16 port);
|
||||||
|
|
||||||
IPv6SocketAddressImpl(const void* addr, UInt16 port, UInt32 scope);
|
IPv6SocketAddressImpl(const void* addr, UInt16 port, UInt32 scope);
|
||||||
|
|
||||||
IPAddress host() const;
|
IPAddress host() const;
|
||||||
|
|
||||||
UInt16 port() const;
|
UInt16 port() const;
|
||||||
|
|
||||||
poco_socklen_t length() const;
|
poco_socklen_t length() const;
|
||||||
|
|
||||||
const struct sockaddr* addr() const;
|
const struct sockaddr* addr() const;
|
||||||
|
|
||||||
int af() const;
|
int af() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class Net_API TimeoutNotification: public SocketNotification
|
class Net_API TimeoutNotification: public SocketNotification
|
||||||
/// This notification is sent if no other event has occured
|
/// This notification is sent if no other event has occurred
|
||||||
/// for a specified time.
|
/// for a specified time.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -83,7 +83,7 @@ class Net_API SocketReactor: public Poco::Runnable
|
|||||||
/// becomes writable. The ErrorNotification will be dispatched if
|
/// becomes writable. The ErrorNotification will be dispatched if
|
||||||
/// there is an error condition on a socket.
|
/// there is an error condition on a socket.
|
||||||
///
|
///
|
||||||
/// If the timeout expires and no event has occured, a
|
/// If the timeout expires and no event has occurred, a
|
||||||
/// TimeoutNotification will be dispatched to all event handlers
|
/// TimeoutNotification will be dispatched to all event handlers
|
||||||
/// registered for it. This is done in the onTimeout() method
|
/// registered for it. This is done in the onTimeout() method
|
||||||
/// which can be overridden by subclasses to perform custom
|
/// which can be overridden by subclasses to perform custom
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
/// reactor.addEventHandler(obs);
|
/// reactor.addEventHandler(obs);
|
||||||
|
|
||||||
bool hasEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
|
bool hasEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
|
||||||
/// Returns true if the observer is reistered with SocketReactor for the given socket.
|
/// Returns true if the observer is registered with SocketReactor for the given socket.
|
||||||
|
|
||||||
void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
|
void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
|
||||||
/// Unregisters an event handler with the SocketReactor.
|
/// Unregisters an event handler with the SocketReactor.
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
int sendBytes(Poco::FIFOBuffer& buffer);
|
int sendBytes(Poco::FIFOBuffer& buffer);
|
||||||
/// Sends the contents of the given buffer through
|
/// Sends the contents of the given buffer through
|
||||||
/// the socket. FIFOBuffer has writable/readable transiton
|
/// the socket. FIFOBuffer has writable/readable transition
|
||||||
/// notifications which may be enabled to notify the caller when
|
/// notifications which may be enabled to notify the caller when
|
||||||
/// the buffer transitions between empty, partially full and
|
/// the buffer transitions between empty, partially full and
|
||||||
/// full states.
|
/// full states.
|
||||||
@ -137,7 +137,7 @@ public:
|
|||||||
int receiveBytes(Poco::FIFOBuffer& buffer);
|
int receiveBytes(Poco::FIFOBuffer& buffer);
|
||||||
/// Receives data from the socket and stores it
|
/// Receives data from the socket and stores it
|
||||||
/// in buffer. Up to length bytes are received. FIFOBuffer has
|
/// in buffer. Up to length bytes are received. FIFOBuffer has
|
||||||
/// writable/readable transiton notifications which may be enabled
|
/// writable/readable transition notifications which may be enabled
|
||||||
/// to notify the caller when the buffer transitions between empty,
|
/// to notify the caller when the buffer transitions between empty,
|
||||||
/// partially full and full states.
|
/// partially full and full states.
|
||||||
///
|
///
|
||||||
|
@ -80,7 +80,7 @@ class Net_API TCPServer: public Poco::Runnable
|
|||||||
public:
|
public:
|
||||||
TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 portNumber = 0, TCPServerParams::Ptr pParams = 0);
|
TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 portNumber = 0, TCPServerParams::Ptr pParams = 0);
|
||||||
/// Creates the TCPServer, with ServerSocket listening on the given port.
|
/// Creates the TCPServer, with ServerSocket listening on the given port.
|
||||||
/// Default port is zero, allowing any availble port. The port number
|
/// Default port is zero, allowing any available port. The port number
|
||||||
/// can be queried through TCPServer::port() member.
|
/// can be queried through TCPServer::port() member.
|
||||||
///
|
///
|
||||||
/// The server takes ownership of the TCPServerConnectionFactory
|
/// The server takes ownership of the TCPServerConnectionFactory
|
||||||
@ -188,6 +188,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// inlines
|
||||||
|
//
|
||||||
inline const ServerSocket& TCPServer::socket() const
|
inline const ServerSocket& TCPServer::socket() const
|
||||||
{
|
{
|
||||||
return _socket;
|
return _socket;
|
||||||
|
@ -235,6 +235,10 @@ void HTMLForm::prepareSubmit(HTTPRequest& request)
|
|||||||
{
|
{
|
||||||
request.setChunkedTransferEncoding(true);
|
request.setChunkedTransferEncoding(true);
|
||||||
}
|
}
|
||||||
|
if (!request.getChunkedTransferEncoding())
|
||||||
|
{
|
||||||
|
request.setContentLength(calculateContentLength());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -250,7 +254,7 @@ void HTMLForm::prepareSubmit(HTTPRequest& request)
|
|||||||
|
|
||||||
std::streamsize HTMLForm::calculateContentLength()
|
std::streamsize HTMLForm::calculateContentLength()
|
||||||
{
|
{
|
||||||
if (_boundary.empty())
|
if (_encoding == ENCODING_MULTIPART && _boundary.empty())
|
||||||
throw HTMLFormException("Form must be prepared");
|
throw HTMLFormException("Form must be prepared");
|
||||||
|
|
||||||
HTMLFormCountingOutputStream c;
|
HTMLFormCountingOutputStream c;
|
||||||
@ -399,7 +403,7 @@ void HTMLForm::writeUrl(std::ostream& ostr)
|
|||||||
|
|
||||||
void HTMLForm::writeMultipart(std::ostream& ostr)
|
void HTMLForm::writeMultipart(std::ostream& ostr)
|
||||||
{
|
{
|
||||||
HTMLFormCountingOutputStream *costr(dynamic_cast<HTMLFormCountingOutputStream*>(&ostr));
|
HTMLFormCountingOutputStream* pCountingOutputStream(dynamic_cast<HTMLFormCountingOutputStream*>(&ostr));
|
||||||
|
|
||||||
MultipartWriter writer(ostr, _boundary);
|
MultipartWriter writer(ostr, _boundary);
|
||||||
for (NameValueCollection::ConstIterator it = begin(); it != end(); ++it)
|
for (NameValueCollection::ConstIterator it = begin(); it != end(); ++it)
|
||||||
@ -428,18 +432,20 @@ void HTMLForm::writeMultipart(std::ostream& ostr)
|
|||||||
header.set("Content-Disposition", disp);
|
header.set("Content-Disposition", disp);
|
||||||
header.set("Content-Type", ita->pSource->mediaType());
|
header.set("Content-Type", ita->pSource->mediaType());
|
||||||
writer.nextPart(header);
|
writer.nextPart(header);
|
||||||
if (costr)
|
if (pCountingOutputStream)
|
||||||
{
|
{
|
||||||
// count only, don't move stream position
|
// count only, don't move stream position
|
||||||
std::streamsize partlen = ita->pSource->getContentLength();
|
std::streamsize partlen = ita->pSource->getContentLength();
|
||||||
if (partlen != PartSource::UNKNOWN_CONTENT_LENGTH)
|
if (partlen != PartSource::UNKNOWN_CONTENT_LENGTH)
|
||||||
costr->addChars(static_cast<int>(partlen));
|
pCountingOutputStream->addChars(static_cast<int>(partlen));
|
||||||
else
|
else
|
||||||
costr->setValid(false);
|
pCountingOutputStream->setValid(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
StreamCopier::copyStream(ita->pSource->stream(), ostr);
|
StreamCopier::copyStream(ita->pSource->stream(), ostr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
writer.close();
|
writer.close();
|
||||||
_boundary = writer.boundary();
|
_boundary = writer.boundary();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ namespace Net {
|
|||||||
#else
|
#else
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
typedef struct _NTPPacketData {
|
struct NTPPacketData
|
||||||
|
{
|
||||||
Poco::Int8 mode:3;
|
Poco::Int8 mode:3;
|
||||||
Poco::Int8 vn:3;
|
Poco::Int8 vn:3;
|
||||||
Poco::Int8 li:2;
|
Poco::Int8 li:2;
|
||||||
@ -43,7 +44,7 @@ typedef struct _NTPPacketData {
|
|||||||
Poco::Int64 ots;
|
Poco::Int64 ots;
|
||||||
Poco::Int64 vts;
|
Poco::Int64 vts;
|
||||||
Poco::Int64 tts;
|
Poco::Int64 tts;
|
||||||
} NTPPacketData;
|
};
|
||||||
#if !defined(POCO_COMPILER_SUN)
|
#if !defined(POCO_COMPILER_SUN)
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
#else
|
#else
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
||||||
using Poco::NumberFormatter;
|
using Poco::NumberFormatter;
|
||||||
using Poco::FastMutex;
|
using Poco::FastMutex;
|
||||||
using Poco::format;
|
using Poco::format;
|
||||||
@ -884,7 +885,7 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly)
|
|||||||
const List& ipList = it->second.addressList();
|
const List& ipList = it->second.addressList();
|
||||||
List::const_iterator ipIt = ipList.begin();
|
List::const_iterator ipIt = ipList.begin();
|
||||||
List::const_iterator ipEnd = ipList.end();
|
List::const_iterator ipEnd = ipList.end();
|
||||||
for (int counter = 0; ipIt != ipEnd; ++ipIt, ++counter)
|
for (; ipIt != ipEnd; ++ipIt)
|
||||||
{
|
{
|
||||||
IPAddress addr = ipIt->get<NetworkInterface::IP_ADDRESS>();
|
IPAddress addr = ipIt->get<NetworkInterface::IP_ADDRESS>();
|
||||||
IPAddress mask = ipIt->get<NetworkInterface::SUBNET_MASK>();
|
IPAddress mask = ipIt->get<NetworkInterface::SUBNET_MASK>();
|
||||||
@ -1360,6 +1361,7 @@ namespace Net {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
NetworkInterface::Type fromNative(u_char nativeType)
|
NetworkInterface::Type fromNative(u_char nativeType)
|
||||||
{
|
{
|
||||||
switch (nativeType)
|
switch (nativeType)
|
||||||
@ -1380,6 +1382,7 @@ NetworkInterface::Type fromNative(u_char nativeType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
||||||
{
|
{
|
||||||
struct sockaddr_dl* sdl = (struct sockaddr_dl*) iface->ifa_addr;
|
struct sockaddr_dl* sdl = (struct sockaddr_dl*) iface->ifa_addr;
|
||||||
@ -1392,6 +1395,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
|||||||
impl.setType(fromNative(sdl->sdl_type));
|
impl.setType(fromNative(sdl->sdl_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@ -1531,6 +1535,7 @@ namespace Net {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
static NetworkInterface::Type fromNative(unsigned arphrd)
|
static NetworkInterface::Type fromNative(unsigned arphrd)
|
||||||
{
|
{
|
||||||
switch (arphrd)
|
switch (arphrd)
|
||||||
@ -1599,6 +1604,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,14 +76,14 @@ void RemoteSyslogChannel::open()
|
|||||||
{
|
{
|
||||||
if (_open) return;
|
if (_open) return;
|
||||||
|
|
||||||
// reset socket for the case that it has been previously closed
|
|
||||||
_socket = DatagramSocket();
|
|
||||||
|
|
||||||
if (_logHost.find(':') != std::string::npos)
|
if (_logHost.find(':') != std::string::npos)
|
||||||
_socketAddress = SocketAddress(_logHost);
|
_socketAddress = SocketAddress(_logHost);
|
||||||
else
|
else
|
||||||
_socketAddress = SocketAddress(_logHost, SYSLOG_PORT);
|
_socketAddress = SocketAddress(_logHost, SYSLOG_PORT);
|
||||||
|
|
||||||
|
// reset socket for the case that it has been previously closed
|
||||||
|
_socket = DatagramSocket(_socketAddress.family());
|
||||||
|
|
||||||
if (_host.empty())
|
if (_host.empty())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -23,6 +23,7 @@ namespace Poco {
|
|||||||
namespace Net {
|
namespace Net {
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// SocketAddressImpl
|
// SocketAddressImpl
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user