📄 authenticate.xpl
字号:
<?xml version="1.0"?><!DOCTYPE methoddef SYSTEM "rpc-method.dtd"><methoddef><name>Authenticate</name><signature>struct struct</signature><help>Description: Accepts authentication requests from nodes and origins. Returns a random challenge number.Arguments: a structure containing KEY VALUE entity_ID IP address:port of the entity that requestes to be authenticatedReturns: a struct containing KEY VALUE ret_code int (numeric return code) ret_val string (message string) nonce challenge number</help><code language="perl"><![CDATA[#!/usr/bin/perluse CommLib qw(node_log);################################################################################ Sub Name: Authenticate## Description: Accepts authentication requests from nodes and origins.# Returns a random challenge number.## Arguments: a structure containing# KEY VALUE# entity_ID IP address:port of the entity that# requestes to be authenticated## Returns: a struct containing# KEY VALUE# ret_code int (numeric return code)# ret_val string (message string)# nonce challenge number### Globals affected:# %nonce_by_ID hash with generated nonce for a given# entity ID################################################################################sub Authenticate { require RRDMlib; my $parm_ref = pop @_; # Gets hash reference for input parameters my ( $entity_ID, $nonce ); # Entity identification and challenge number $entity_ID = $$parm_ref{entity_ID}; # Entity IP address:port node_log ( "*** Authenticate invoked by $entity_ID", 1, 'r'); # Generates challenge number $nonce = int ( rand(100000000) ); # Saves the nonce in %nonce_by_ID $RRDMlib::nonce_by_ID{$entity_ID} = $nonce; return { ret_code => '200', ret_val => 'OK', nonce => $nonce };}__END__]]></code></methoddef>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -