|<B>new Net::Radius::Packet B>$dictionary<B>, B>$data<B>B>||Returns a new Net::Radius::Packet object. $dictionary is an optional reference to a Net::Radius::Dictionary object. If not supplied, you must call <B>set_dictB>.|
2. Operation If any Proxy-State attributes were present in the Access-Request, they MUST be copied unmodified and in order into the response packet. Other Attributes can be placed before, after, or even between the Proxy-State attributes. 2.3 Proxy The forwarding server MUST treat any Proxy-State attributes already in the packet as opaque data. Its operation MUST NOT depend on the content of Proxy-State attributes added by previous servers. If there are any Proxy-State attributes in the request received from the client, the forwarding server MUST include those Proxy-State attributes in its reply to the client. The forwarding server MAY include the Proxy-State attributes in the access-request when it forwards the request, or MAY omit them in the forwarded request. If the forwarding server omits the Proxy-State attributes in the forwarded access-request, it MUST attach them to the response before sending it to the client.
->pack() and ->dump() now work properly with multiple atributes, in particular the Proxy-State attribute - This means that the packet will be encoded with the multiple attributes present. This change makes Net::Radius::PacketOrdered likely redundant.
->attr() method always return the last attribute inserted.
->set_attr() and ->set_vsattr() methods push either the attribute or the vendor-specific attribute, onto the Attributes stack, or overwrites it in specific circumnstances, as described in method documentation. The ->unset_attr() and ->unset_vsattr() perform the opposite function.
There are actually two families of object methods. The ones described below deal with standard RADIUS attributes. An additional set of methods handle the Vendor-Specific attributes as defined in the RADIUS protocol. Those methods behave in much the same way as the ones below with the exception that the prefix <B>vsB> must be applied before the <B>attrB> in most of the names. The vendor code must also be included as the first parameter of the call.
The <B>vsattrB> and <B>set_vsattrB> methods, used to query and set Vendor-Specific attributes return an array reference with the values of each instance of the particular attribute in the packet. This difference is required to support multiple VSAs with different parameters in the same packet.
<B>->set_dict($dictionary)B> Net::Radius::Packet needs access to a Net::Radius::Dictionary object to do packing and unpacking. set_dict must be called with an appropriate dictionary reference (see Net::Radius::Dictionary) before you can use -><B>packB> or -><B>unpackB>. <B>->unpack($data)B> Given a raw RADIUS packet $data, unpacks its contents so that they can be retrieved with the other methods (<B>codeB>, <B>attrB>, etc.). <B>->packB> Returns a raw RADIUS packet suitable for sending to a RADIUS client or server. <B>->codeB> Returns the Code field as a string. As of this writing, the following codes are defined:
Access-Request Access-Accept Access-Reject Accounting-Request Accounting-Response Accounting-Status Interim-Accounting Password-Request Password-Ack Password-Reject Accounting-Message Access-Challenge Status-Server Status-Client Resource-Free-Request Resource-Free-Response Resource-Query-Request Resource-Query-Response Alternate-Resource-Reclaim-Request NAS-Reboot-Request NAS-Reboot-Response Next-Passcode New-Pin Terminate-Session Password-Expired Event-Request Event-Response Disconnect-Request Disconnect-ACK Disconnect-NAK CoA-Request CoA-ACK CoA-NAK IP-Address-Allocate IP-Address-Release
<B>->set_code($code)B> Sets the Code field to the string supplied. <B>->B>identifier()<B>B> Returns the one-byte Identifier used to match requests with responses, as a character value. <B>->set_identifier($id)B> Sets the Identifier byte to the character supplied. <B>->B>authenticator()<B>B> Returns the 16-byte Authenticator field as a character string. <B>->set_authenticator($authenticator)B> Sets the Authenticator field to the character string supplied. <B>->attr($name)B> Retrieves the value of the named Attribute. Attributes will be converted automatically based on their dictionary type:
The following types are simply mapped to other types until correct encoding is implemented:
<B>ipv6addrB> Treated as a string <B>dateB> Treated as a string <B>ifidB> Treated as a string
When multiple attributes are inserted in the packet, the last one is returned.
<B>->set_attr($name, B>$val<B>, B>$rewrite_flag<B>)B> Sets the named Attributes to the given value. Values should be supplied as they would be returned from the <B>attrB> method. If rewrite_flag is set, and a single attribute with such name already exists on the Attributes stack, its value will be overwriten with the supplied one. In all other cases (if there are more than one attributes with such name already on the stack, there are no attributes with such name, rewrite_flag is omitted) name/pair array will be pushed onto the stack. <B>->set_vsattr($vendor, B>$name<B>, B>$val<B>, B>$rewrite_flag<B>)B> Analogous to ->set_attr(), but operates on vendor-specific attributes for vendor $vendor. <B>->unset_attr($name)B> Sets the named Attribute to the given value. Values should be supplied as they would be returned from the <B>attrB> method. <B>->unset_vsattr($vendor, B>$name<B>)B> Analogous to ->unset_attr(), but operates on vendor-specific attributes for vendor $vendor. <B>->attr_slot($integer)B> Deprecated synonym for ->attr_slot_val(). <B>->B>attr_slots()<B>B> Return the number of attribute slots in the packet. <B>->attr_slot_name($integer)B> Retrieves the attribute name of the given slot number from the Attributes stack. Returns undef when the slot is vacant. <B>->attr_slot_val($integer)B> Retrieves the attribute value of the given slot number from the Attributes stack. Returns undef when the slot is vacant. <B>->B>unset_attr_slot<B>($integer)B> Removes given stack position from the Attributes stack. <B>->password($secret, [$attr])B> The RADIUS User-Password attribute is encoded with a shared secret. Use this method to return the decoded version. By default, the password will be looked for in the User-Password attribute. You can specify an alternate RADIUS attribute, by using the second argument. <B>->set_password($passwd, B>$secret<B>, [$attribute])B> The RADIUS User-Password attribute is encoded with a shared secret. Use this method to prepare the encoded version. The encoded password will be stored in the attribute $attribute, which defaults to User-Password.
Some servers have been reported on insisting on this attribute to be Password instead. You may have to tweak this call or the dictionary accordingly.
<B>->B>dump()<B>B> Prints the content of the packet to STDOUT. <B>->show_unknown_entries($bool)B> Controls the generation of a warn() whenever an unknown tuple is seen.
<B>auth_resp($packed_packet, B>$secret<B> [, accounting])B> Given a (packed) RADIUS packet and a shared secret, returns a new packet with the Authenticator field changed in accordace with RADIUS protocol requirements.
If the third optional parameter is true, the Authenticator is encoded for an accounting packet, using 16 0x0 octets as the placeholder for the authenticator.
<B>auth_acct_verify($packet, B>$secret<B>)B> Verifies the authenticator in an <B>Accounting-RequestB> packet as explained in RFC-2866. Returns 1 if the authenticator matches the packet and the secret, undef otherwise.
$packet is the packet data, as received. $secret is the corresponding shared secret.
<B>auth_req_verify($packet, B>$secret<B>, B>$prev_auth<B>)B> Verifies the authenticator in <B>Access-AcceptB>, <B>Access-RejectB>, and <B>Access-ChallengeB> packets as explained in RFC-2865. Returns 1 if the authenticator matches the packet and the secret, undef otherwise.
Its the applications job to keep track of the authenticators in each request.
See the examples included in the <B>examples/B> directory of the distribution. Also see Net::Radius::Server(3) for a more complete implementation of a RADIUS server.
Christopher Masto, <firstname.lastname@example.org>. VSA support by Luis E. Munõz, <email@example.com>. Fix for unpacking 3COM VSAs contributed by Ian Smith <firstname.lastname@example.org>. Information for packing of 3Com VSAs provided by Quan Choi <Quan_Choi@3com.com>. Some functions contributed by Tony Mountifield <email@example.com>. Attribute ordering provided by Toni Prug, <firstname.lastname@example.org>, idea by Bill Hulley.
Perl, Net::Radius::Server(3), Net::Radius::Dictionary(3), RFCs 2865, 2866, 2882 and 3575.
Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 1002: Non-ASCII character seen before =encoding in Munõz,. Assuming UTF-8
|perl v5.20.3||RADIUS::PACKET (3)||2009-09-11|