📄 classcradiusattribute.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: CRadiusAttribute 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>CRadiusAttribute Class Reference</h1>Implementation of RADIUS attribute. <a href="#_details">More...</a><p><code>#include <<a class="el" href="CRadiusAttribute_8h-source.html">CRadiusAttribute.h</a>></code><p><a href="classCRadiusAttribute-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><a class="anchor" name="a0" doxytag="CRadiusAttribute::CRadiusAttribute" ></a> </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a0">CRadiusAttribute</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a1" doxytag="CRadiusAttribute::~CRadiusAttribute" ></a> </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a1">~CRadiusAttribute</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a2">dump</a> (char *p_buf)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Dump attribute in readable text format to the text buffer. <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a3">init</a> (<a class="el" href="classCRadiusPacket.html">CRadiusPacket</a> *p_packet, ACE_UINT16 p_offset)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Init attribute. <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a4" doxytag="CRadiusAttribute::getPacket" ></a><a class="el" href="classCRadiusPacket.html">CRadiusPacket</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a4">getPacket</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get packet that this attribute belongs to. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a5" doxytag="CRadiusAttribute::getOffset" ></a>ACE_UINT16 </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a5">getOffset</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get attribute's offset inside the packet. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a6">getType</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get attribute type. <a href="#a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a7">setType</a> (unsigned char p_type)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set attribute type. <a href="#a7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="a8" doxytag="CRadiusAttribute::getTypeDescription" ></a>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a8">getTypeDescription</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get textual description of attribute type. <br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a9">getLength</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get attribute length. <a href="#a9"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a10">setLength</a> (unsigned char p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set attribute length. <a href="#a10"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a11">isValid</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Attribute is valid? <a href="#a11"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>ACE_UINT32 </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a12">getNumber</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the numeric attribute. <a href="#a12"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a13">setNumber</a> (ACE_UINT32 p_value)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the numeric attribute. <a href="#a13"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>in_addr </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a14">getIPAddress</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the IP address attribute. <a href="#a14"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a15">setIPAddress</a> (struct in_addr p_value)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the IP address attribute. <a href="#a15"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a16">getString</a> (unsigned char *&p_data, ACE_UINT16 &p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the string attribute. <a href="#a16"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a17">setString</a> (unsigned char *p_data, ACE_UINT16 p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the string attribute. <a href="#a17"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>ACE_UINT32 </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a18">getVendorId</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get vendor ID of Vendor-Specific attribute. <a href="#a18"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a19">setVendorId</a> (ACE_UINT32 p_vendorId)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set vendor ID of Vendor-Specific attribute. <a href="#a19"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a20">getVendorString</a> (unsigned char *&p_data, ACE_UINT16 &p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get string data of Vendor-Specific attribute. <a href="#a20"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a21">setVendorString</a> (unsigned char *p_data, ACE_UINT16 p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set string data of Vendor-Specific attribute. <a href="#a21"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a22">getVendorType</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get vendor type of Vendor-Specific attribute. <a href="#a22"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a23">setVendorType</a> (unsigned char p_value)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set vendor type of Vendor-Specific attribute. <a href="#a23"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a24">getVendorLength</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get vendor length of Vendor-Specific attribute. <a href="#a24"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a25">setVendorLength</a> (unsigned char p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set vendor length of Vendor-Specific attribute. <a href="#a25"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>ACE_UINT32 </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a26">getVendorExtNumber</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the numeric attribute. <a href="#a26"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a27">setVendorExtNumber</a> (ACE_UINT32 p_value)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the vendor-specific numeric attribute. <a href="#a27"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>in_addr </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a28">getVendorExtAddress</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the vendor-specific IP address attribute. <a href="#a28"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a29">setVendorExtAddress</a> (struct in_addr p_address)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the vendor-specific IP address attribute. <a href="#a29"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a30">getVendorExtString</a> (unsigned char *&p_data, ACE_UINT16 &p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get value of the vendor-specific string attribute. <a href="#a30"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a31">setVendorExtString</a> (unsigned char *&p_data, ACE_UINT16 &p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set value of the vendor-specific string attribute. <a href="#a31"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a32">getUserPassword</a> (unsigned char p_data[], ACE_UINT16 &p_length, <a class="el" href="classCRadiusSecret.html">CRadiusSecret</a> *p_secret=NULL)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get string data of User-Password attribute. <a href="#a32"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a33">setUserPassword</a> (unsigned char *p_data, ACE_UINT16 p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set string data of User-Password attribute. <a href="#a33"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a35">getChapIdentifier</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get CHAP identifier of CHAP-Password attribute. <a href="#a35"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a36">setChapIdentifier</a> (unsigned char p_chapId)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set vendor ID of CHAP-Password attribute. <a href="#a36"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a37">getChapString</a> (unsigned char *&p_data, ACE_UINT16 &p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get string data of CHAP-Password attribute. <a href="#a37"></a><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#a38">setChapString</a> (unsigned char *p_data, ACE_UINT16 p_length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set string data of CHAP-Password attribute. <a href="#a38"></a><br></td></tr><tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classCRadiusAttribute.html#d1">dump</a> (char *p_buf, AttributeFormat_e p_format)</td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Implementation of RADIUS attribute. <p>This class does not keep any data - instead it provides methods to properly access and encode data at specific offset inside the RADIUS packet raw data buffer.<p>This implementation minimizes the footprint of RADIUS stack and does not require dynamic memory allocations. It's also very fast (at least in the typical RADIUS applications) since the data is immediately encoded inside the packet. <p><hr><h2>Member Function Documentation</h2><a class="anchor" name="d1" doxytag="CRadiusAttribute::dump" ></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"> void CRadiusAttribute::dump </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname" nowrap> <em>p_buf</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>AttributeFormat_e </td> <td class="mdname" nowrap> <em>p_format</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [private]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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_buf</em> </td><td>- buffer where the attribute will be dumped to; buffer should have enough space to carry the dump output </td></tr> <tr><td><tt>[in]</tt> </td><td valign=top><em>p_format</em> </td><td>- attribute format; </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a2" doxytag="CRadiusAttribute::dump" ></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"> void CRadiusAttribute::dump </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname1" valign="top" nowrap> <em>p_buf</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Dump attribute in readable text format to the text buffer. <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_buf</em> </td><td>- buffer where the attribute will be dumped to; buffer should have enough space to carry the dump output </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a35" doxytag="CRadiusAttribute::getChapIdentifier" ></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"> unsigned char CRadiusAttribute::getChapIdentifier </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get CHAP identifier of CHAP-Password attribute. <p><dl compact><dt><b>Returns:</b></dt><dd>CHAP identifier </dd></dl> </td> </tr></table><a class="anchor" name="a37" doxytag="CRadiusAttribute::getChapString" ></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"> int CRadiusAttribute::getChapString </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned char *& </td> <td class="mdname" nowrap> <em>p_data</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_length</em></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>Get string data of CHAP-Password attribute. <p>Note that string data may contain both readable characters and non-readable binary data. In any case string will not be null-terminated, hence application should use returned p_length value to properly operate with it.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td><tt>[out]</tt> </td><td valign=top><em>p_data</em> </td><td>- pointer to the beginning of string data </td></tr> <tr><td><tt>[out]</tt> </td><td valign=top><em>p_length</em> </td><td>- string length </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>RC_SUCCESS or RC_FAIL </dd></dl> </td> </tr></table><a class="anchor" name="a14" doxytag="CRadiusAttribute::getIPAddress" ></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"> struct in_addr CRadiusAttribute::getIPAddress </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get value of the IP address attribute. <p><dl compact><dt><b>Returns:</b></dt><dd>value of IP address attribute </dd></dl> </td> </tr></table><a class="anchor" name="a9" doxytag="CRadiusAttribute::getLength" ></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"> unsigned char CRadiusAttribute::getLength </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get attribute length. <p>Note that returned value is length of the attribute data block as encoded in raw RADIUS packet (in other words it's simply a value of Length octet in attribute data). You must take into account specific attribute type in order to calculate the "real data" length.<p><dl compact><dt><b>Returns:</b></dt><dd>attribute's length </dd></dl> </td> </tr></table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -