forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auth mgr generic header files (sonic-net#18632)
- Loading branch information
1 parent
71c426d
commit 673d73c
Showing
9 changed files
with
1,715 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2024 Broadcom Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef AUTHMGR_H | ||
#define AUTHMGR_H | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* Authentication Manager Timers */ | ||
typedef enum | ||
{ | ||
AUTH_MGR_RESTART = 0, | ||
} auth_mgr_timer_t; | ||
|
||
/* Authentication Manager Event Message IDs */ | ||
typedef enum | ||
{ | ||
authMgrMethodSet = 1, | ||
authMgrPrioritySet, | ||
authMgrOpenAccess, | ||
authMgrRestartTimerSet, | ||
authMgrRestartTimerExpiry, | ||
authMgrNimStartup, | ||
authMgrCnfgr, | ||
authMgrActivateStartupDone, | ||
authMgrHandleNewBackupManager | ||
}authMgrMessages_t; | ||
|
||
typedef enum | ||
{ | ||
AUTH_MGR_UNAUTHENTICATED = 0, | ||
AUTH_MGR_AUTHENTICATED | ||
} authMgrAuthStatus_t; | ||
|
||
|
||
typedef struct authMgrIntfChangeParms_s | ||
{ | ||
uint32 event; | ||
NIM_CORRELATOR_t correlator; | ||
} authMgrIntfChangeParms_t; | ||
|
||
typedef struct authMgrNimStartup_s | ||
{ | ||
NIM_STARTUP_PHASE_t startupPhase; | ||
} authMgrNimStartup_t; | ||
|
||
typedef struct authMgrTimerParams_s | ||
{ | ||
uint32 timerCBHandle; | ||
} authMgrTimerParams_t; | ||
#define AUTHMGR_TIMER_MSG_SIZE sizeof(authMgrTimerParams_t) | ||
|
||
/* authentication manager Event Message format */ | ||
typedef struct authMgrMgmtMsg_s | ||
{ | ||
uint32 msgId; /* Of type snoopMgmtMessages_t */ | ||
uint32 intIfNum; | ||
union | ||
{ | ||
CNFGR_CMD_DATA_t CmdData; | ||
authMgrIntfChangeParms_t authMgrIntfChangeParms; | ||
authMgrNimStartup_t authMgrNimStartup; | ||
uint32 mode; | ||
authMgrTimerParams_t authMgrParams; | ||
uint32 timerValue; | ||
} u; | ||
} authMgrMgmtMsg_t; | ||
#define AUTHMGR_MSG_SIZE sizeof(authMgrMgmtMsg_t) | ||
|
||
|
||
/* Start of Function Prototype */ | ||
void authMgrNotifyRegisteredUsers(uint32 intIfNum, | ||
uint32 event); | ||
/* End of function prototypes */ | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* AUTHMGR_H */ | ||
|
55 changes: 55 additions & 0 deletions
55
src/sonic-pac/authmgr/mapping/include/auth_mgr_auth_method.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2024 Broadcom Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef AUTHMGR_AUTHMETHOD_H | ||
#define AUTHMGR_AUTHMETHOD_H | ||
|
||
#include <stddef.h> | ||
#include "mab_socket.h" | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define ETHERNET_PREFIX "Ethernet" | ||
|
||
typedef struct authmgrMethodEvent_s | ||
{ | ||
authmgrNotifyEvent_t event; | ||
char8 eventStr[16]; | ||
}authmgrMethodEvent_t; | ||
|
||
RC_t authmgrDot1xEventSend (uint32 intIfNum, uint32 event, enetMacAddr_t *macAddr); | ||
RC_t authmgrDot1xIntfAdminModeGet (uint32 intIfNum, BOOL *enabled); | ||
RC_t authmgrDot1xIntfPortControlModeSet (uint32 intIfNum, AUTHMGR_PORT_CONTROL_t portControl); | ||
RC_t authmgrDot1xPortPaeCapabilitiesGet (uint32 intIfNum, uchar8 * capabilities); | ||
int wpa_sync_send(char * ctrl_ifname, char * cmd, char *buf, size_t *len); | ||
int authmgrMabDataSend(mab_pac_cmd_t *req, char *resp, unsigned int *len); | ||
RC_t authmgrMabEventSend (uint32 intIfNum, uint32 event, enetMacAddr_t *macAddr); | ||
RC_t authmgrMabIntfAdminModeGet (uint32 intIfNum, BOOL *enabled); | ||
|
||
int handle_async_resp_data(int *listen_sock); | ||
|
||
/* End of function prototypes */ | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* AUTHMGR_AUTHMETHOD_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright 2024 Broadcom Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef INCLUDE_AUTHMGR_CFG_H | ||
#define INCLUDE_AUTHMGR_CFG_H | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "nim_data.h" | ||
|
||
#define AUTHMGR_IS_READY (((authmgrCnfgrState == AUTHMGR_PHASE_INIT_3) || \ | ||
(authmgrCnfgrState == AUTHMGR_PHASE_EXECUTE) || \ | ||
(authmgrCnfgrState == AUTHMGR_PHASE_UNCONFIG_1)) ? ( TRUE) : ( FALSE)) | ||
|
||
typedef enum { | ||
AUTHMGR_PHASE_INIT_0 = 0, | ||
AUTHMGR_PHASE_INIT_1, | ||
AUTHMGR_PHASE_INIT_2, | ||
AUTHMGR_PHASE_WMU, | ||
AUTHMGR_PHASE_INIT_3, | ||
AUTHMGR_PHASE_EXECUTE, | ||
AUTHMGR_PHASE_UNCONFIG_1, | ||
AUTHMGR_PHASE_UNCONFIG_2, | ||
} authmgrCnfgrState_t; | ||
|
||
#define AUTHMGR_LLDP_PROFILES_MAX 128 | ||
|
||
typedef struct authmgrPortCfg_s | ||
{ | ||
nimConfigID_t configId; /* NIM config ID for this interface*/ | ||
/* if port is operating as supplicnat, | ||
the functionality is redundant */ | ||
/* Authentication methods */ | ||
AUTHMGR_METHOD_t methodList[ AUTHMGR_METHOD_LAST]; | ||
AUTHMGR_METHOD_t priorityList[ AUTHMGR_METHOD_LAST]; | ||
AUTHMGR_PORT_CONTROL_t portControlMode; /* Current control mode setting by mgmt */ | ||
AUTHMGR_HOST_CONTROL_t hostMode; /* Current host mode setting by mgmt */ | ||
uint32 quietPeriod; /* Initialization value for txWhen timer */ | ||
uint32 reAuthPeriod; /* Number of seconds between periodic reauthentication */ | ||
BOOL reAuthEnabled; /* TRUE if reauthentication is enabled */ | ||
uint32 maxUsers; /*Maximum no. users in Mac-Based Authentication */ | ||
uint32 maxAuthAttempts; /* Maximum number of times authentication may be reattempted by the user radius */ | ||
/* variable to hold config related to session time out is to be used | ||
from radius server */ | ||
BOOL reAuthPeriodServer; | ||
uint32 inActivityPeriod; /* Number of seconds to wait after which clients can be cleaned up due to inactivity */ | ||
uint32 intfConfigMask; | ||
uchar8 paeCapabilities; | ||
} authmgrPortCfg_t; | ||
|
||
typedef struct authmgrCfg_s | ||
{ | ||
fileHdr_t cfgHdr; | ||
uint32 adminMode; | ||
uint32 authmgrLogTraceMode; /* Enable/disable log file tracing */ | ||
uint32 vlanAssignmentMode;/* Global mode to enable vlan assignment */ | ||
authmgrPortCfg_t authmgrPortCfg[ AUTHMGR_INTF_MAX_COUNT]; /* Per-port config info */ | ||
AUTHMGR_PORT_CONTROL_t portControlMode; /* Current control mode setting by mgmt */ | ||
AUTHMGR_HOST_CONTROL_t hostMode; /* Current host mode setting by mgmt */ | ||
} authmgrCfg_t; | ||
|
||
extern authmgrCfg_t *authmgrCfg; | ||
|
||
typedef struct authmgrDebugCfgData_s | ||
{ | ||
BOOL authmgrDebugPacketTraceTxFlag; | ||
BOOL authmgrDebugPacketTraceRxFlag; | ||
} authmgrDebugCfgData_t; | ||
|
||
typedef struct authmgrDebugCfg_s | ||
{ | ||
fileHdr_t hdr; | ||
authmgrDebugCfgData_t cfg; | ||
uint32 checkSum; | ||
} authmgrDebugCfg_t; | ||
|
||
extern RC_t authmgrSave(void); | ||
extern BOOL authmgrHasDataChanged(void); | ||
extern void authmgrResetDataChanged(void); | ||
|
||
extern RC_t authmgrCfgDump(void); | ||
extern void authmgrBuildDefaultConfigData(void); | ||
extern void authmgrBuildDefaultIntfConfigData(nimConfigID_t *configId, authmgrPortCfg_t *pCfg); | ||
|
||
extern RC_t authmgrApplyConfigData(void); | ||
extern RC_t authmgrApplyPortConfigData(uint32 intIfNum); | ||
extern RC_t authmgrPortReset(uint32 intIfNum); | ||
|
||
extern void authmgrApiCnfgrCommand( CNFGR_CMD_DATA_t *pCmdData); | ||
extern RC_t authmgrInit(void); | ||
extern void authmgrInitUndo(); | ||
extern RC_t authmgrCnfgrInitPhase1Process(void); | ||
extern RC_t authmgrCnfgrInitPhase2Process(void); | ||
extern RC_t authmgrCnfgrInitPhase3Process( BOOL warmRestart); | ||
extern void authmgrCnfgrFiniPhase1Process(); | ||
extern void authmgrCnfgrFiniPhase2Process(); | ||
extern void authmgrCnfgrFiniPhase3Process(); | ||
extern RC_t authmgrCnfgrNoopProccess( CNFGR_RESPONSE_t *pResponse, | ||
CNFGR_ERR_RC_t *pReason ); | ||
extern RC_t authmgrCnfgrUconfigPhase2( CNFGR_RESPONSE_t *pResponse, | ||
CNFGR_ERR_RC_t *pReason ); | ||
extern void authmgrCnfgrParse( CNFGR_CMD_DATA_t *pCmdData); | ||
|
||
extern RC_t authmgrLogicalPortInfoSetPortInfo(authmgrLogicalPortInfo_t *logicalPortInfo); | ||
extern RC_t authmgrLogicalPortInfoInitialize(authmgrLogicalPortInfo_t *logicalPortInfo); | ||
extern RC_t authmgrLogicalPortReset(authmgrLogicalPortInfo_t *logicalPortInfo); | ||
extern void authmgrCnfgrTerminateProcess( CNFGR_CMD_DATA_t *pCmdData); | ||
|
||
/* USE C Declarations */ | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* INCLUDE_AUTHMGR_CFG_H */ |
Oops, something went wrong.