📄 sslsocket_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>sslsocket.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>sslsocket.h</h1><div class="fragment"><pre>00001 <font class="comment">/*************************************************************************</font>
00002 <font class="comment"> * *</font>
00003 <font class="comment"> * This program is free software; you can redistribute it and/or modify *</font>
00004 <font class="comment"> * it under the terms of the GNU General Public License as published by *</font>
00005 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or *</font>
00006 <font class="comment"> * (at your option) any later version. *</font>
00007 <font class="comment"> * *</font>
00008 <font class="comment"> *************************************************************************/</font>
00009
00010 <font class="preprocessor">#ifndef _SSLSOCKET_H__</font>
00011 <font class="preprocessor"></font><font class="preprocessor">#define _SSLSOCKET_H__</font>
00012 <font class="preprocessor"></font>
00013 <font class="preprocessor">#include "global.h"</font>
00014 <font class="preprocessor">#include "socket.h"</font>
00015 <font class="preprocessor">#include "exception.h"</font>
00016 <font class="preprocessor">#include "logger.h"</font>
00017 <font class="preprocessor">#include "i18n.h"</font>
00018 <font class="preprocessor">#include "socket.h"</font>
00019 <font class="preprocessor">#include <strings.h></font>
00020 <font class="preprocessor">#include <unistd.h></font>
00021 <font class="preprocessor">#include <arpa/inet.h></font>
00022 <font class="preprocessor">#include <netdb.h></font>
00023 <font class="preprocessor">#include <sys/socket.h></font>
00024 <font class="preprocessor">#include <netinet/in.h></font>
00025 <font class="preprocessor">#include <errno.h></font>
00026 <font class="preprocessor">#include <string></font>
00027 <font class="preprocessor">#include <openssl/crypto.h></font>
00028 <font class="preprocessor">#include <openssl/x509.h></font>
00029 <font class="preprocessor">#include <openssl/pem.h></font>
00030 <font class="preprocessor">#include <openssl/ssl.h></font>
00031 <font class="preprocessor">#include <openssl/err.h></font>
00032
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00034
<a name="l00045"></a><a class="code" href="classSSLSocket.html">00045</a> <font class="keyword">class </font><a class="code" href="classSSLSocket.html">SSLSocket</a> : <font class="keyword">public</font> <a class="code" href="classSocket.html">Socket</a>
00046 {
00047 <font class="keyword">public</font>:
00053 <a class="code" href="classSSLSocket.html#a0">SSLSocket</a> (<font class="keyword">const</font> string &<a class="code" href="classSocket.html#n0">host</a>);
00054
00061 <a class="code" href="classSSLSocket.html#a0">SSLSocket</a> (<font class="keyword">const</font> string &<a class="code" href="classSocket.html#n0">host</a>, <font class="keywordtype">int</font> fd);
00062
<a name="l00068"></a><a class="code" href="classSSLSocket.html#s2">00068</a> <font class="keyword">enum</font> <a class="code" href="classSSLSocket.html#s2">SSL_OPTS</a> { VERIFY_PEER, VERIFY_NONE };
00069
00073 <font class="keyword">virtual</font> <a class="code" href="classSSLSocket.html#a2">~SSLSocket</a> ();
00074
00087 string <a class="code" href="classSSLSocket.html#a3">readSocket</a> ();
00088
00102 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#a4">writeSocket</a> (<font class="keyword">const</font> string &data);
00103
00109 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#a5">setSSLOpts</a> (<a class="code" href="classSSLSocket.html#s2">SSL_OPTS</a> opts);
00110
00148 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#a6">setVerifyLocations</a> (<font class="keyword">const</font> string &<a class="code" href="classSSLSocket.html#n4">ca_file</a>, <font class="keyword">const</font> string &<a class="code" href="classSSLSocket.html#n5">ca_dir</a>);
00149
00158 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#a7">negotiate</a> ();
00159
00160 <font class="keyword">protected</font>:
00161
<a name="l00165"></a><a class="code" href="classSSLSocket.html#n0">00165</a> SSL_CTX * <a class="code" href="classSSLSocket.html#n0">ctx</a>;
00166
<a name="l00170"></a><a class="code" href="classSSLSocket.html#n1">00170</a> SSL * <a class="code" href="classSSLSocket.html#n1">ssl</a>;
00171
<a name="l00176"></a><a class="code" href="classSSLSocket.html#n2">00176</a> <font class="keywordtype">bool</font> <a class="code" href="classSSLSocket.html#n2">negotiated</a>;
00177
<a name="l00181"></a><a class="code" href="classSSLSocket.html#n3">00181</a> <font class="keywordtype">int</font> <a class="code" href="classSSLSocket.html#n3">verify</a>;
00182
<a name="l00186"></a><a class="code" href="classSSLSocket.html#n4">00186</a> string <a class="code" href="classSSLSocket.html#n4">ca_file</a>;
00187
<a name="l00192"></a><a class="code" href="classSSLSocket.html#n5">00192</a> string <a class="code" href="classSSLSocket.html#n5">ca_dir</a>;
00193
00197 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#b0">dumpSSLInfo</a> ();
00198
00208 string <a class="code" href="classSSLSocket.html#b1">ssl_readSocket</a> ();
00209
00220 <font class="keywordtype">void</font> <a class="code" href="classSSLSocket.html#b2">ssl_writeSocket</a> (<font class="keyword">const</font> string &data);
00221
00230 string <a class="code" href="classSSLSocket.html#b3">ssl_error</a> (<font class="keywordtype">int</font> ret = 65536);
00231
00238 <font class="keywordtype">int</font> <a class="code" href="classSSLSocket.html#b4">ssl_read</a> (SSL * <a class="code" href="classSSLSocket.html#n1">ssl</a>, <font class="keywordtype">void</font> * buf, <font class="keywordtype">int</font> num);
00239
00246 <font class="keywordtype">int</font> <a class="code" href="classSSLSocket.html#b5">ssl_write</a> (SSL * <a class="code" href="classSSLSocket.html#n1">ssl</a>, <font class="keyword">const</font> <font class="keywordtype">void</font> * buf, <font class="keywordtype">int</font> num);
00247
00254 <font class="keywordtype">int</font> <a class="code" href="classSSLSocket.html#b6">ssl_connect</a> (SSL * <a class="code" href="classSSLSocket.html#n1">ssl</a>);
00255 };
00256
00257 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Tue Jan 28 17:09:58 2003 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -