File: Poco.Net.SecureSocketImpl.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (182 lines) | stat: -rw-r--r-- 15,578 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Net::SecureSocketImpl</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Net.html" class="namespace">Poco::Net</a></h1>
<h1 class="symbol">class SecureSocketImpl</h1>
</div>
<div class="body">
<p>
<b>Library:</b> NetSSL_OpenSSL<br />
<b>Package:</b> SSLSockets<br />
<b>Header:</b> Poco/Net/SecureSocketImpl.h</p>
<h2>Description</h2>
<div class="description">
<p>The <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> for <a href="Poco.Net.SecureStreamSocket.html" title="class Poco::Net::SecureStreamSocket">SecureStreamSocket</a>. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Net.SecureSocketImpl.html#16089" title="Poco::Net::SecureSocketImpl::acceptConnection()">acceptConnection</a>, <a href="Poco.Net.SecureSocketImpl.html#16125" title="Poco::Net::SecureSocketImpl::acceptSSL()">acceptSSL</a>, <a href="Poco.Net.SecureSocketImpl.html#16100" title="Poco::Net::SecureSocketImpl::bind()">bind</a>, <a href="Poco.Net.SecureSocketImpl.html#16106" title="Poco::Net::SecureSocketImpl::close()">close</a>, <a href="Poco.Net.SecureSocketImpl.html#16115" title="Poco::Net::SecureSocketImpl::completeHandshake()">completeHandshake</a>, <a href="Poco.Net.SecureSocketImpl.html#16091" title="Poco::Net::SecureSocketImpl::connect()">connect</a>, <a href="Poco.Net.SecureSocketImpl.html#16098" title="Poco::Net::SecureSocketImpl::connectNB()">connectNB</a>, <a href="Poco.Net.SecureSocketImpl.html#16126" title="Poco::Net::SecureSocketImpl::connectSSL()">connectSSL</a>, <a href="Poco.Net.SecureSocketImpl.html#16118" title="Poco::Net::SecureSocketImpl::context()">context</a>, <a href="Poco.Net.SecureSocketImpl.html#16124" title="Poco::Net::SecureSocketImpl::getPeerHostName()">getPeerHostName</a>, <a href="Poco.Net.SecureSocketImpl.html#16132" title="Poco::Net::SecureSocketImpl::handleError()">handleError</a>, <a href="Poco.Net.SecureSocketImpl.html#16130" title="Poco::Net::SecureSocketImpl::isLocalHost()">isLocalHost</a>, <a href="Poco.Net.SecureSocketImpl.html#16103" title="Poco::Net::SecureSocketImpl::listen()">listen</a>, <a href="Poco.Net.SecureSocketImpl.html#16117" title="Poco::Net::SecureSocketImpl::peerCertificate()">peerCertificate</a>, <a href="Poco.Net.SecureSocketImpl.html#16111" title="Poco::Net::SecureSocketImpl::receiveBytes()">receiveBytes</a>, <a href="Poco.Net.SecureSocketImpl.html#16134" title="Poco::Net::SecureSocketImpl::reset()">reset</a>, <a href="Poco.Net.SecureSocketImpl.html#16107" title="Poco::Net::SecureSocketImpl::sendBytes()">sendBytes</a>, <a href="Poco.Net.SecureSocketImpl.html#16122" title="Poco::Net::SecureSocketImpl::setPeerHostName()">setPeerHostName</a>, <a href="Poco.Net.SecureSocketImpl.html#16105" title="Poco::Net::SecureSocketImpl::shutdown()">shutdown</a>, <a href="Poco.Net.SecureSocketImpl.html#16116" title="Poco::Net::SecureSocketImpl::sockfd()">sockfd</a>, <a href="Poco.Net.SecureSocketImpl.html#16128" title="Poco::Net::SecureSocketImpl::verifyCertificate()">verifyCertificate</a>, <a href="Poco.Net.SecureSocketImpl.html#16119" title="Poco::Net::SecureSocketImpl::verifyPeerCertificate()">verifyPeerCertificate</a></p>
<h2>Constructors</h2>
<h3><a name="16085">SecureSocketImpl</a></h3>
<p class="decl"><a href="Poco.Net.SecureSocketImpl.html" title="class Poco::Net::SecureSocketImpl">SecureSocketImpl</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.AutoPtr.html" title="class Poco::AutoPtr">Poco::AutoPtr</a> &lt; <a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> &gt; pSocketImpl,<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Net.Context.html#15711" title="Poco::Net::Context::Ptr">Context::Ptr</a> pContext<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.Net.SecureSocketImpl.html" title="class Poco::Net::SecureSocketImpl">SecureSocketImpl</a> using an already connected stream socket. </p>
</div>
<h2>Destructor</h2>
<h3><a name="16088">~SecureSocketImpl</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual ~<a href="Poco.Net.SecureSocketImpl.html" title="class Poco::Net::SecureSocketImpl">SecureSocketImpl</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Net.SecureSocketImpl.html" title="class Poco::Net::SecureSocketImpl">SecureSocketImpl</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="16089">acceptConnection</a></h3>
<p class="decl"><a href="Poco.Net.SocketImpl.html" title="class Poco::Net::SocketImpl">SocketImpl</a> * acceptConnection(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> &amp; clientAddr<br />);</p>
<div class="description">
<p>Get the next completed connection from the socket's completed connection queue. </p>
<p>If the queue is empty, waits until a connection request completes. </p>
<p>Returns a new SSL socket for the connection with the client. </p>
<p>The client socket's address is returned in clientAddr. </p>
</div>
<h3><a name="16100">bind</a></h3>
<p class="decl">void bind(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> &amp; address,<br />&nbsp;&nbsp;&nbsp;&nbsp;bool reuseAddress = false<br />);</p>
<div class="description">
<p>Bind a local address to the socket. </p>
<p>This is usually only done when establishing a server socket. SSL clients should not bind a socket to a specific address. </p>
<p>If reuseAddress is true, sets the SO_REUSEADDR socket option. </p>
</div>
<h3><a name="16106">close</a></h3>
<p class="decl">void close();</p>
<div class="description">
<p>Close the socket. </p>
</div>
<h3><a name="16115">completeHandshake</a></h3>
<p class="decl">int completeHandshake();</p>
<div class="description">
<p>Completes the SSL handshake. </p>
<p>If the SSL connection was the result of an accept(), the server-side handshake is completed, otherwise a client-side handshake is performed.  </p>
</div>
<h3><a name="16091">connect</a></h3>
<p class="decl">void connect(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> &amp; address,<br />&nbsp;&nbsp;&nbsp;&nbsp;bool performHandshake<br />);</p>
<div class="description">
<p>Initializes the socket and establishes a secure connection to  the TCP server at the given address. </p>
<p>If performHandshake is true, the SSL handshake is performed immediately  after establishing the connection. Otherwise, the handshake is performed the first time <a href="Poco.Net.SecureSocketImpl.html#16107" title="Poco::Net::SecureSocketImpl::sendBytes()">sendBytes</a>(), <a href="Poco.Net.SecureSocketImpl.html#16111" title="Poco::Net::SecureSocketImpl::receiveBytes()">receiveBytes</a>() or <a href="Poco.Net.SecureSocketImpl.html#16115" title="Poco::Net::SecureSocketImpl::completeHandshake()">completeHandshake</a>() is called. </p>
</div>
<h3><a name="16094">connect</a></h3>
<p class="decl">void connect(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> &amp; address,<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Timespan.html" title="class Poco::Timespan">Poco::Timespan</a> &amp; timeout,<br />&nbsp;&nbsp;&nbsp;&nbsp;bool performHandshake<br />);</p>
<div class="description">
<p>Initializes the socket, sets the socket timeout and  establishes a secure connection to the TCP server at the given address. </p>
<p>If performHandshake is true, the SSL handshake is performed immediately  after establishing the connection. Otherwise, the handshake is performed the first time <a href="Poco.Net.SecureSocketImpl.html#16107" title="Poco::Net::SecureSocketImpl::sendBytes()">sendBytes</a>(), <a href="Poco.Net.SecureSocketImpl.html#16111" title="Poco::Net::SecureSocketImpl::receiveBytes()">receiveBytes</a>() or <a href="Poco.Net.SecureSocketImpl.html#16115" title="Poco::Net::SecureSocketImpl::completeHandshake()">completeHandshake</a>() is called. </p>
</div>
<h3><a name="16098">connectNB</a></h3>
<p class="decl">void connectNB(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Net.SocketAddress.html" title="class Poco::Net::SocketAddress">SocketAddress</a> &amp; address<br />);</p>
<div class="description">
<p>Initializes the socket and establishes a secure connection to  the TCP server at the given address. Prior to opening the connection the socket is set to nonblocking mode. </p>
</div>
<h3><a name="16118">context</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Net.Context.html#15711" title="Poco::Net::Context::Ptr">Context::Ptr</a> context() const;</p>
<div class="description">
<p>Returns the SSL context used for this socket. </p>
</div>
<h3><a name="16124">getPeerHostName</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const std::string &amp; getPeerHostName() const;</p>
<div class="description">
<p>Returns the peer host name. </p>
</div>
<h3><a name="16103">listen</a></h3>
<p class="decl">void listen(<br />&nbsp;&nbsp;&nbsp;&nbsp;int backlog = 64<br />);</p>
<div class="description">
<p>Puts the socket into listening state. </p>
<p>The socket becomes a passive socket that can accept incoming connection requests. </p>
<p>The backlog argument specifies the maximum number of connections that can be queued for this socket. </p>
</div>
<h3><a name="16117">peerCertificate</a></h3>
<p class="decl">X509 * peerCertificate() const;</p>
<div class="description">
<p>Returns the peer's certificate. </p>
</div>
<h3><a name="16111">receiveBytes</a></h3>
<p class="decl">int receiveBytes(<br />&nbsp;&nbsp;&nbsp;&nbsp;void * buffer,<br />&nbsp;&nbsp;&nbsp;&nbsp;int length,<br />&nbsp;&nbsp;&nbsp;&nbsp;int flags = 0<br />);</p>
<div class="description">
<p>Receives data from the socket and stores it in buffer. Up to length bytes are received. </p>
<p>Returns the number of bytes received. </p>
</div>
<h3><a name="16107">sendBytes</a></h3>
<p class="decl">int sendBytes(<br />&nbsp;&nbsp;&nbsp;&nbsp;const void * buffer,<br />&nbsp;&nbsp;&nbsp;&nbsp;int length,<br />&nbsp;&nbsp;&nbsp;&nbsp;int flags = 0<br />);</p>
<div class="description">
<p>Sends the contents of the given buffer through the socket. <a href="Poco.Any.html" title="class Poco::Any">Any</a> specified flags are ignored. </p>
<p>Returns the number of bytes sent, which may be less than the number of bytes specified. </p>
</div>
<h3><a name="16122">setPeerHostName</a></h3>
<p class="decl">void setPeerHostName(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; hostName<br />);</p>
<div class="description">
<p>Sets the peer host name for certificate validation purposes. </p>
</div>
<h3><a name="16105">shutdown</a></h3>
<p class="decl">void shutdown();</p>
<div class="description">
<p>Shuts down the connection by attempting an orderly SSL shutdown, then actually shutting down the TCP connection. </p>
</div>
<h3><a name="16116">sockfd</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int sockfd();</p>
<div class="description">
<p>Returns the underlying socket descriptor. </p>
</div>
<h3><a name="16119">verifyPeerCertificate</a></h3>
<p class="decl">void verifyPeerCertificate();</p>
<div class="description">
<p>Performs post-connect (or post-accept) peer certificate validation, using the peer host name set with <a href="Poco.Net.SecureSocketImpl.html#16122" title="Poco::Net::SecureSocketImpl::setPeerHostName()">setPeerHostName</a>(), or the peer's IP address string if no peer host name has been set. </p>
</div>
<h3><a name="16120">verifyPeerCertificate</a></h3>
<p class="decl">void verifyPeerCertificate(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; hostName<br />);</p>
<div class="description">
<p>Performs post-connect (or post-accept) peer certificate validation using the given peer host name. </p>
</div>
<h3><a name="16125">acceptSSL</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void acceptSSL();</p>
<div class="description">
<p>Performs a server-side SSL handshake and certificate verification. </p>
</div>
<h3><a name="16126">connectSSL</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void connectSSL(<br />&nbsp;&nbsp;&nbsp;&nbsp;bool performHandshake<br />);</p>
<div class="description">
<p>Performs a client-side SSL handshake and establishes a secure  connection over an already existing TCP connection. </p>
</div>
<h3><a name="16132">handleError</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int handleError(<br />&nbsp;&nbsp;&nbsp;&nbsp;int rc<br />);</p>
<div class="description">
<p>Handles an SSL error by throwing an appropriate exception. </p>
</div>
<h3><a name="16130">isLocalHost</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" />  <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static bool isLocalHost(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; hostName<br />);</p>
<div class="description">
<p>Returns true if and only if the given host name is the local host  (either &quot;localhost&quot; or &quot;127.0.0.1&quot;). </p>
</div>
<h3><a name="16134">reset</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void reset();</p>
<div class="description">
<p>Prepares the socket for re-use.  </p>
<p>After closing and resetting a socket, the socket can be used for a new connection. </p>
<p>Note that simply closing a socket is not sufficient to be able to re-use it again. </p>
</div>
<h3><a name="16128">verifyCertificate</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">long verifyCertificate(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; hostName<br />);</p>
<div class="description">
<p>Performs post-connect (or post-accept) peer certificate validation. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>