radius.h
Go to the documentation of this file.
1 /**
2  * @file radius.h
3  * @brief RADIUS (Remote Authentication Dial In User Service)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2022-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneEAP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _RADIUS_H
32 #define _RADIUS_H
33 
34 //Dependencies
35 #include "eap/eap.h"
36 
37 //RADIUS support
38 #ifndef RADIUS_SUPPORT
39  #define RADIUS_SUPPORT ENABLED
40 #elif (RADIUS_SUPPORT != ENABLED && RADIUS_SUPPORT != DISABLED)
41  #error RADIUS_SUPPORT parameter is not valid
42 #endif
43 
44 //RADIUS port number
45 #define RADIUS_PORT 1812
46 
47 //C++ guard
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
53 /**
54  * @brief RADIUS codes
55  **/
56 
57 typedef enum
58 {
59  RADIUS_CODE_ACCESS_REQUEST = 1, ///<Access-Request
60  RADIUS_CODE_ACCESS_ACCEPT = 2, ///<Access-Accept
61  RADIUS_CODE_ACCESS_REJECT = 3, ///<Access-Reject
62  RADIUS_CODE_ACCOUNTING_REQUEST = 4, ///<Accounting-Request
63  RADIUS_CODE_ACCOUNTING_RESPONSE = 5, ///<Accounting-Response
64  RADIUS_CODE_ACCESS_CHALLENGE = 11, ///<Access-Challenge
65  RADIUS_CODE_STATUS_SERVER = 12, ///<Status-Server (experimental)
66  RADIUS_CODE_STATUS_CLIENT = 13 ///<Status-Client (experimental)
68 
69 
70 //CC-RX, CodeWarrior or Win32 compiler?
71 #if defined(__CCRX__)
72  #pragma pack
73 #elif defined(__CWCC__) || defined(_WIN32)
74  #pragma pack(push, 1)
75 #endif
76 
77 
78 /**
79  * @brief RADIUS packet
80  **/
81 
83 {
84  uint8_t code; //0
85  uint8_t identifier; //1
86  uint16_t length; //2-3
87  uint8_t authenticator[16]; //4-19
88  uint8_t attributes[]; //20
90 
91 
92 //CC-RX, CodeWarrior or Win32 compiler?
93 #if defined(__CCRX__)
94  #pragma unpack
95 #elif defined(__CWCC__) || defined(_WIN32)
96  #pragma pack(pop)
97 #endif
98 
99 //C++ guard
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif
uint8_t code
Definition: coap_common.h:179
EAP (Extensible Authentication Protocol)
uint16_t length
Definition: radius.h:86
RadiusCode
RADIUS codes.
Definition: radius.h:58
@ RADIUS_CODE_ACCESS_REJECT
Access-Reject.
Definition: radius.h:61
@ RADIUS_CODE_ACCOUNTING_REQUEST
Accounting-Request.
Definition: radius.h:62
@ RADIUS_CODE_ACCESS_REQUEST
Access-Request.
Definition: radius.h:59
@ RADIUS_CODE_STATUS_CLIENT
Status-Client (experimental)
Definition: radius.h:66
@ RADIUS_CODE_ACCESS_CHALLENGE
Access-Challenge.
Definition: radius.h:64
@ RADIUS_CODE_STATUS_SERVER
Status-Server (experimental)
Definition: radius.h:65
@ RADIUS_CODE_ACCESS_ACCEPT
Access-Accept.
Definition: radius.h:60
@ RADIUS_CODE_ACCOUNTING_RESPONSE
Accounting-Response.
Definition: radius.h:63
RadiusPacket
Definition: radius.h:89
uint8_t attributes[]
Definition: radius.h:88
uint8_t authenticator[16]
Definition: radius.h:87
typedef __packed_struct
RADIUS packet.
Definition: radius.h:83
uint8_t identifier
Definition: radius.h:85