66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
|
|
/**
|
||
|
|
* RADIUS Protocol Core Interfaces
|
||
|
|
* Based on RFC 2865 (Authentication) and RFC 2866 (Accounting)
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { ERadiusCode } from './enums.js';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Attribute value type
|
||
|
|
*/
|
||
|
|
export type TAttributeValueType = 'text' | 'string' | 'address' | 'integer' | 'time' | 'vsa';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Attribute definition
|
||
|
|
*/
|
||
|
|
export interface IAttributeDefinition {
|
||
|
|
type: number;
|
||
|
|
name: string;
|
||
|
|
valueType: TAttributeValueType;
|
||
|
|
encrypted?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Raw attribute (type-length-value)
|
||
|
|
*/
|
||
|
|
export interface IRadiusAttribute {
|
||
|
|
type: number;
|
||
|
|
value: Buffer;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Parsed attribute with named value
|
||
|
|
*/
|
||
|
|
export interface IParsedAttribute {
|
||
|
|
type: number;
|
||
|
|
name: string;
|
||
|
|
value: string | number | Buffer;
|
||
|
|
rawValue: Buffer;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Vendor-Specific Attribute
|
||
|
|
*/
|
||
|
|
export interface IVendorSpecificAttribute {
|
||
|
|
vendorId: number;
|
||
|
|
vendorType: number;
|
||
|
|
vendorValue: Buffer;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* RADIUS Packet structure
|
||
|
|
*/
|
||
|
|
export interface IRadiusPacket {
|
||
|
|
code: ERadiusCode;
|
||
|
|
identifier: number;
|
||
|
|
authenticator: Buffer;
|
||
|
|
attributes: IRadiusAttribute[];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Parsed RADIUS packet with named attributes
|
||
|
|
*/
|
||
|
|
export interface IParsedRadiusPacket extends IRadiusPacket {
|
||
|
|
parsedAttributes: IParsedAttribute[];
|
||
|
|
}
|