📄 classcradiusclientconnection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>ace-radius: CRadiusClientConnection Class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.7-20040704 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a></div><h1>CRadiusClientConnection Class Reference</h1>Connection between client RADIUS stack and single RADIUS server. <a href="#_details">More...</a><p><code>#include <<a class="el" href="CRadiusClientConnection_8h-source.html">CRadiusClientConnection.h</a>></code><p><p>Inheritance diagram for CRadiusClientConnection:<p><center><img src="classCRadiusClientConnection.png" usemap="#CRadiusClientConnection_map" border="0" alt=""></center><map name="CRadiusClientConnection_map"><area href="classCTask.html" alt="CTask" shape="rect" coords="0,0,155,24"></map><a href="classCRadiusClientConnection-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a0">CRadiusClientConnection</a> (<a class="el" href="classCRadiusClientStack.html">CRadiusClientStack</a> *p_stack, <a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> *p_secret, const char *p_hostname, ACE_UINT16 p_port=D_RADIUS_AUTHENTICATION_PORT, const char *p_localHostname=NULL, ACE_UINT16 p_localPort=0, int p_responseTimeout=5, int p_retransmitCount=4, int p_disableConnectionThreshold=20, int p_disableConnectionTimeout=15)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a1">start</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Start underlying thread. <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a2">sendPacket</a> (<a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *p_data)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Send RADIUS packet. <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a3">handleMessage</a> (ACE_Message_Block *p_msg)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Message handler. <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a4">handleTimeout</a> (<a class="el" href="classCTimer.html">CTimer</a> *p_timer)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Timeout handler. <a href="#a4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a5" doxytag="CRadiusClientConnection::svcHandler" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a5">svcHandler</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Svc handler - receive RADIUS response packets. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a6">disable</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Disable connection. <a href="#a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a7" doxytag="CRadiusClientConnection::getSecret" ></a><a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#a7">getSecret</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get instance of RADIUS secret class. <br></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d0">send</a> (<a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *p_data)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Send RADIUS packet - really do the job. <a href="#d0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d1">addToMap</a> (unsigned char p_id, <a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *p_data)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Add packet data to map. <a href="#d1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d2">findInMap</a> (unsigned char p_id)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Find packet data in map. <a href="#d2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d3">removeFromMap</a> (unsigned char p_id)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Remove packet data from map. <a href="#d3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d4">startRetransmitTimer</a> (<a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *p_data)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Start retransmit timer. <a href="#d4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d5">validateResponse</a> (<a class="el" href="classCRadiusPacket.html">CRadiusPacket</a> *p_responsePacket, <a class="el" href="classCRadiusPacket.html">CRadiusPacket</a> *p_requestPacket)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Validate RADIUS response. <a href="#d5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#d6">transmitFailure</a> (<a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *p_data)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Packet transmission failed on specific connection. <a href="#d6"></a><br></td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r0" doxytag="CRadiusClientConnection::m_stack" ></a><a class="el" href="classCRadiusClientStack.html">CRadiusClientStack</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r0">m_stack</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">RADIUS stack that this connection belongs to. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r1" doxytag="CRadiusClientConnection::m_secret" ></a><a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r1">m_secret</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">RADIUS secret key. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r2" doxytag="CRadiusClientConnection::m_packet" ></a><a class="el" href="classCRadiusPacket.html">CRadiusPacket</a> </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r2">m_packet</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">RADIUS packet that is being currently received. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r3" doxytag="CRadiusClientConnection::m_serverAddress" ></a>ACE_INET_Addr </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r3">m_serverAddress</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Server address. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r4" doxytag="CRadiusClientConnection::m_clientAddress" ></a>ACE_INET_Addr </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r4">m_clientAddress</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Client address. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r5" doxytag="CRadiusClientConnection::m_socket" ></a>ACE_SOCK_Dgram </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r5">m_socket</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">UDP socket. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r6" doxytag="CRadiusClientConnection::m_failureCount" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r6">m_failureCount</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Number of conseqently failed packets. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r7" doxytag="CRadiusClientConnection::m_isDisabled" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r7">m_isDisabled</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This connection is temporarily disabled? <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r8" doxytag="CRadiusClientConnection::m_disabledTime" ></a>ACE_Time_Value </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r8">m_disabledTime</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">When the connection was disabled? <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r9" doxytag="CRadiusClientConnection::m_disableConnectionThreshold" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r9">m_disableConnectionThreshold</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">How many packets should consequently fail to transmit in order to disable this connection? <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r10" doxytag="CRadiusClientConnection::m_disableConnectionTimeout" ></a>ACE_Time_Value </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r10">m_disableConnectionTimeout</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">For how long connection that fails to transmit packets is disabled? <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>ACE_Map_Manager< unsigned <br>char, <a class="el" href="classCRadiusClientData.html">CRadiusClientData</a> *,<br> ACE_Null_Mutex > </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r11">m_packetMap</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">RADIUS packets map. <a href="#r11"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r12" doxytag="CRadiusClientConnection::m_responseTimeout" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r12">m_responseTimeout</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">RADIUS server response timeout (in seconds). <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="r13" doxytag="CRadiusClientConnection::m_retransmitCount" ></a>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusClientConnection.html#r13">m_retransmitCount</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Max number of packet retransmits towards specific connection. <br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Connection between client RADIUS stack and single RADIUS server. <p>Each connection has it's own retransmission settings. It also maintains it's "current state" based on the success or failure in passing the last packets. When number of consequently failed packets reaches predefined threshold, connection becomes disabled and doesn't transmit any traffic towards the remote RADIUS server. After predefined time disabled connection is "reenabled" and continues transmitting the traffic.<p>Single connection may simultaneously transmit up to 256 packets. If application needs to pass more traffic, it should create multiple connections against the same server within the same <a class="el" href="classCRadiusClientStack.html">CRadiusClientStack</a>. Each connection will use it's own local port and thus overcome packet ID restriction. <p><hr><h2>Constructor & Destructor Documentation</h2><a class="anchor" name="a0" doxytag="CRadiusClientConnection::CRadiusClientConnection" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> CRadiusClientConnection::CRadiusClientConnection </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classCRadiusClientStack.html">CRadiusClientStack</a> * </td> <td class="mdname" nowrap> <em>p_stack</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> * </td> <td class="mdname" nowrap> <em>p_secret</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>p_hostname</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>ACE_UINT16 </td> <td class="mdname" nowrap> <em>p_port</em> = <code>D_RADIUS_AUTHENTICATION_PORT</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>p_localHostname</em> = <code>NULL</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>ACE_UINT16 </td> <td class="mdname" nowrap> <em>p_localPort</em> = <code>0</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>p_responseTimeout</em> = <code>5</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>p_retransmitCount</em> = <code>4</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>p_disableConnectionThreshold</em> = <code>20</code>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>p_disableConnectionTimeout</em> = <code>15</code></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor. <p>note that constructing CRadiusClientConnection is not enough - you should explicitly call <a class="el" href="classCRadiusClientConnection.html#a1">start()</a> method in order to create underlying thread<p>It's worth noting that only pointer to the secret key object is stored inside the class, so application should keep instance of <a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> class as long as this instance of CRadiusClientConnection class exists.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_stack</em> </td><td>- RADIUS client stack that this connection belongs to </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_secret</em> </td><td>- secret key </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_hostname</em> </td><td>- RADIUS server hostname </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_port</em> </td><td>- RADIUS server port </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_localHostname</em> </td><td>- local hostname (optional, usually there is no need to specify it) </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_localPort</em> </td><td>- local port (optional, usually there is no need to specify it) </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_responseTimeout</em> </td><td>- RADIUS server response timeout (in sec) </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_retransmitCount</em> </td><td>- max number of packet retransmits </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_disableConnectionThreshold</em> </td><td>- how many packets should consequently fail to transmit in order to disable this connection </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_disableConnectionTimeout</em> </td><td>- for how long connection is disabled when it's failure is detected </td></tr> </table></dl> </td> </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="d1" doxytag="CRadiusClientConnection::addToMap" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -