mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-24 23:04:43 +01:00
Support RFC3576
This commit is contained in:
@@ -14,6 +14,7 @@ This supports the following RFC dictionaries at the moment:
|
||||
- [RFC2866](https://tools.ietf.org/html/rfc2866)
|
||||
- [RFC2867](https://tools.ietf.org/html/rfc2867)
|
||||
- [RFC2868](https://tools.ietf.org/html/rfc2868)
|
||||
- [RFC3576](https://tools.ietf.org/html/rfc3576)
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -29,7 +30,6 @@ Simple example implementations are here:
|
||||
- Support the following RFC dictionaries:
|
||||
- rfc2869
|
||||
- rfc3162
|
||||
- rfc3576
|
||||
- rfc3580
|
||||
- rfc4072
|
||||
- rfc4372
|
||||
|
||||
33
dicts/dictionary.rfc3576
Normal file
33
dicts/dictionary.rfc3576
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- text -*-
|
||||
# Copyright (C) 2020 The FreeRADIUS Server project and contributors
|
||||
# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
|
||||
# Version $Id$
|
||||
#
|
||||
# Attributes and values defined in RFC 3576.
|
||||
# http://www.ietf.org/rfc/rfc3576.txt
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
ATTRIBUTE Error-Cause 101 integer
|
||||
|
||||
# Service Types
|
||||
|
||||
VALUE Service-Type Authorize-Only 17
|
||||
|
||||
# Error causes
|
||||
|
||||
VALUE Error-Cause Residual-Context-Removed 201
|
||||
VALUE Error-Cause Invalid-EAP-Packet 202
|
||||
VALUE Error-Cause Unsupported-Attribute 401
|
||||
VALUE Error-Cause Missing-Attribute 402
|
||||
VALUE Error-Cause NAS-Identification-Mismatch 403
|
||||
VALUE Error-Cause Invalid-Request 404
|
||||
VALUE Error-Cause Unsupported-Service 405
|
||||
VALUE Error-Cause Unsupported-Extension 406
|
||||
VALUE Error-Cause Administratively-Prohibited 501
|
||||
VALUE Error-Cause Proxy-Request-Not-Routable 502
|
||||
VALUE Error-Cause Session-Context-Not-Found 503
|
||||
VALUE Error-Cause Session-Context-Not-Removable 504
|
||||
VALUE Error-Cause Proxy-Processing-Error 505
|
||||
VALUE Error-Cause Resources-Unavailable 506
|
||||
VALUE Error-Cause Request-Initiated 507
|
||||
@@ -7,4 +7,5 @@ pub mod rfc2865;
|
||||
pub mod rfc2866;
|
||||
pub mod rfc2867;
|
||||
pub mod rfc2868;
|
||||
pub mod rfc3576;
|
||||
pub mod tag;
|
||||
|
||||
44
radius/src/rfc3576.rs
Normal file
44
radius/src/rfc3576.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
// Code generated by machine generator; DO NOT EDIT.
|
||||
|
||||
use crate::avp::{AVPError, AVPType, AVP};
|
||||
use crate::packet::Packet;
|
||||
|
||||
pub type ErrorCause = u32;
|
||||
pub const ERROR_CAUSE_RESIDUAL_CONTEXT_REMOVED: ErrorCause = 201;
|
||||
pub const ERROR_CAUSE_INVALID_EAP_PACKET: ErrorCause = 202;
|
||||
pub const ERROR_CAUSE_UNSUPPORTED_ATTRIBUTE: ErrorCause = 401;
|
||||
pub const ERROR_CAUSE_MISSING_ATTRIBUTE: ErrorCause = 402;
|
||||
pub const ERROR_CAUSE_NAS_IDENTIFICATION_MISMATCH: ErrorCause = 403;
|
||||
pub const ERROR_CAUSE_INVALID_REQUEST: ErrorCause = 404;
|
||||
pub const ERROR_CAUSE_UNSUPPORTED_SERVICE: ErrorCause = 405;
|
||||
pub const ERROR_CAUSE_UNSUPPORTED_EXTENSION: ErrorCause = 406;
|
||||
pub const ERROR_CAUSE_ADMINISTRATIVELY_PROHIBITED: ErrorCause = 501;
|
||||
pub const ERROR_CAUSE_PROXY_REQUEST_NOT_ROUTABLE: ErrorCause = 502;
|
||||
pub const ERROR_CAUSE_SESSION_CONTEXT_NOT_FOUND: ErrorCause = 503;
|
||||
pub const ERROR_CAUSE_SESSION_CONTEXT_NOT_REMOVABLE: ErrorCause = 504;
|
||||
pub const ERROR_CAUSE_PROXY_PROCESSING_ERROR: ErrorCause = 505;
|
||||
pub const ERROR_CAUSE_RESOURCES_UNAVAILABLE: ErrorCause = 506;
|
||||
pub const ERROR_CAUSE_REQUEST_INITIATED: ErrorCause = 507;
|
||||
|
||||
pub type ServiceType = u32;
|
||||
pub const SERVICE_TYPE_AUTHORIZE_ONLY: ServiceType = 17;
|
||||
|
||||
pub const ERROR_CAUSE_TYPE: AVPType = 101;
|
||||
pub fn delete_error_cause(packet: &mut Packet) {
|
||||
packet.delete(ERROR_CAUSE_TYPE);
|
||||
}
|
||||
pub fn add_error_cause(packet: &mut Packet, value: ErrorCause) {
|
||||
packet.add(AVP::from_u32(ERROR_CAUSE_TYPE, value as u32));
|
||||
}
|
||||
pub fn lookup_error_cause(packet: &Packet) -> Option<Result<ErrorCause, AVPError>> {
|
||||
packet
|
||||
.lookup(ERROR_CAUSE_TYPE)
|
||||
.map(|v| Ok(v.encode_u32()? as ErrorCause))
|
||||
}
|
||||
pub fn lookup_all_error_cause(packet: &Packet) -> Result<Vec<ErrorCause>, AVPError> {
|
||||
let mut vec = Vec::new();
|
||||
for avp in packet.lookup_all(ERROR_CAUSE_TYPE) {
|
||||
vec.push(avp.encode_u32()? as ErrorCause)
|
||||
}
|
||||
Ok(vec)
|
||||
}
|
||||
Reference in New Issue
Block a user