All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rlm_securid.h
Go to the documentation of this file.
1 #ifndef _RLM_SECURID_H
2 #define _RLM_SECURID_H
3 
4 #include <freeradius-devel/radiusd.h>
5 #include <freeradius-devel/modules.h>
6 #include <freeradius-devel/rad_assert.h>
7 
8 #include "acexport.h"
9 
10 #define SAFE_STR(s) s==NULL?"EMPTY":s
11 
12 typedef enum {
22 
23 /*
24  * SECURID_SESSION is used to identify existing securID sessions
25  * to continue Next-Token code and New-Pin conversations with a client
26  *
27  * next = pointer to next
28  * state = state attribute from the reply we sent
29  * state_len = length of data in the state attribute.
30  * src_ipaddr = client which sent us the RADIUS request containing
31  * this SecurID conversation.
32  * timestamp = timestamp when this handler was last used.
33  * trips = number of trips
34  * identity = Identity of the user
35  * request = RADIUS request data structure
36  */
37 
38 #define SECURID_STATE_LEN 32
39 typedef struct _securid_session_t {
41  SDI_HANDLE sdiHandle;
43 
45 
47  time_t timestamp;
48  unsigned int session_id;
49  uint32_t trips;
50 
51  char *pin; /* previous pin if user entered it during NEW-PIN mode process */
52  char *identity; /* save user's identity name for future use */
53 
55 
56 
57 /*
58  * Define a structure for our module configuration.
59  *
60  * These variables do not need to be in a structure, but it's
61  * a lot cleaner to do so, and a pointer to the structure can
62  * be used as the instance handle.
63  * sessions = remembered sessions, in a tree for speed.
64  * mutex = ensure only one thread is updating the sessions list
65  */
66 typedef struct rlm_securid_t {
67  pthread_mutex_t session_mutex;
70 
71  unsigned int last_session_id;
72 
73  /*
74  * Configuration items.
75  */
76  uint32_t timer_limit;
77  uint32_t max_sessions;
80 
81 /* Memory Management */
84  CC_HINT(nonnull);
85 
87 
89  CC_HINT(nonnull);
91 
92 
93 #endif
SECURID_SESSION_STATE
Definition: rlm_securid.h:12
void securid_sessionlist_free(rlm_securid_t *inst, REQUEST *request) CC_HINT(nonnull)
Definition: mem.c:69
rbtree_t * session_tree
Definition: rlm_securid.h:68
fr_ipaddr_t src_ipaddr
Definition: rlm_securid.h:46
#define CC_HINT(_x)
Definition: build.h:71
#define inst
struct rlm_securid_t rlm_securid_t
int securid_sessionlist_add(rlm_securid_t *inst, REQUEST *request, SECURID_SESSION *session) CC_HINT(nonnull)
Definition: mem.c:93
SECURID_SESSION_STATE securidSessionState
Definition: rlm_securid.h:42
SDI_HANDLE sdiHandle
Definition: rlm_securid.h:41
struct _securid_session_t * next
Definition: rlm_securid.h:40
unsigned int session_id
Definition: rlm_securid.h:48
SECURID_SESSION * session_tail
Definition: rlm_securid.h:69
unsigned int last_session_id
Definition: rlm_securid.h:71
uint32_t max_sessions
Definition: rlm_securid.h:77
uint32_t max_trips_per_session
Definition: rlm_securid.h:78
struct _securid_session_t * prev
Definition: rlm_securid.h:40
#define SECURID_STATE_LEN
Definition: rlm_securid.h:38
SECURID_SESSION * securid_sessionlist_find(rlm_securid_t *inst, REQUEST *request) CC_HINT(nonnull)
Definition: mem.c:181
void securid_session_free(rlm_securid_t *inst, REQUEST *request, SECURID_SESSION *session) CC_HINT(nonnull)
SECURID_SESSION * session_head
Definition: rlm_securid.h:69
uint32_t timer_limit
Definition: rlm_securid.h:76
IPv4/6 prefix.
Definition: inet.h:41
char state[SECURID_STATE_LEN]
Definition: rlm_securid.h:44
pthread_mutex_t session_mutex
Definition: rlm_securid.h:67
SECURID_SESSION * securid_session_alloc(void)
Definition: mem.c:30
struct _securid_session_t SECURID_SESSION