|
|
Class to check inbound MD5 authenticated packets and add authentication data to outbound OSPF packets. The OSPFv2 MD5 authentication scheme is described in Section D.3 of RFC 2328.
static const OspfTypes::AuType AUTH_TYPE | AUTH_TYPE |
MD5Key (struct) | MD5Key |
Structure to hold MD5 key information.
typedef list<MD5Key> KeyChain | KeyChain |
KeyChain::const_iterator key_at (uint32_t when_secs)
| key_at |
[const]
Get iterator pointing at first key valid at a particular time.
Parameters:
when_secs | time in seconds since midnight 1 Jan 1970. |
MD5AuthHandler (EventLoop& eventloop)
| MD5AuthHandler |
Constructor
Parameters:
eventloop | the EventLoop instance to used for time reference. |
bool authenticate_inbound (const vector<uint8_t>& packet,
const IPv4& src_addr,
bool new_peer)
| authenticate_inbound |
Inbound authentication method.
Parameters:
packet | the packet to verify. |
src_addr | the source address of the packet. |
new_peer | true if this is a new peer. |
Returns: true if packet passes authentication checks, false otherwise.
Reimplemented from AuthHandlerBase.
bool authenticate_outbound (vector<uint8_t>& packet)
| authenticate_outbound |
Outbound authentication method.
Parameters:
packet | the packet to authenticate. |
Returns: true if packet was successfully authenticated, false when no valid keys are present.
Reimplemented from AuthHandlerBase.
const char* name ()
| name |
[const]
Get the name of the authentication scheme.
Returns: the name of the authentication scheme.
Reimplemented from AuthHandlerBase.
const char* auth_type_name ()
| auth_type_name |
[static]
Get the method-specific name of the authentication scheme.
Returns: the method-specific name of the authentication scheme.
void reset ()
| reset |
Reset the authentication state.
Reimplemented from AuthHandlerBase.
uint32_t additional_payload ()
| additional_payload |
[const]
Additional bytes that will be added to the payload.
Returns: the number of additional bytes that need to be added to the payload.
Reimplemented from AuthHandlerBase.
bool add_key (uint8_t key_id,
const string& key,
uint32_t start_secs,
uint32_t end_secs)
| add_key |
Add key to MD5 key chain. If key already exists, it is updated with new settings. If the start and end times are the same the key is treated as persistant and will not expire.
Parameters:
key_id | unique ID associated with key. |
key | phrase used for MD5 digest computation. |
start_secs | start time in seconds since midnight 1 Jan 1970. |
end_secs | start time in seconds since midnight 1 Jan 1970. |
Returns: true on success, false if end time is less than start time or key has already expired.
bool remove_key (uint8_t key_id)
| remove_key |
Remove key from MD5 key chain.
Parameters:
key_id | unique ID of key to be removed. |
Returns: true if the key was found and removed, otherwise false.
void remove_key_cb (uint8_t key_id)
| remove_key_cb |
A callback to remove key from MD5 key chain.
Parameters:
key_id | unique ID of key to be removed. |
uint16_t currently_active_key ()
| currently_active_key |
[const]
Get currently active key.
Returns: key ID in range 0-255 if key exists, value outside valid range otherwise 256-65535.
void reset_keys ()
| reset_keys |
Reset the keys for all sources.
inline const KeyChain& key_chain ()
| key_chain |
[const]
Get all keys managed by MD5AuthHandler.
Returns: list of keys.
KeyChain::iterator key_at (uint32_t when_secs)
| key_at |
[protected]
Get iterator pointing at first key valid at a particular time.
Parameters:
when_secs | time in seconds since midnight 1 Jan 1970. |
EventLoop& _eventloop | _eventloop |
[protected]
KeyChain _key_chain | _key_chain |
[protected]