yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
Session Control

Server sessions are allocated in order connect request received. More...

Collaboration diagram for Session Control:

Functions

status_t agt_ses_init (void)
 INIT 1: Initialize the session manager module data structures. More...
 
void agt_ses_cleanup (void)
 Cleanup the session manager module data structures. More...
 
ses_cb_tagt_ses_new_dummy_session (void)
 Create a dummy session control block. More...
 
status_t agt_ses_set_dummy_session_acm (ses_cb_t *dummy_session, ses_id_t use_sid)
 Set the session ID and username of the user that will be responsible for the rollback if needed. More...
 
status_t agt_ses_set_dummy_session_tcb (ses_cb_t *dummy_session, ses_id_t use_sid)
 Set the session TCB if needed. More...
 
void agt_ses_free_dummy_session (ses_cb_t *scb)
 Free a dummy session control block. More...
 
ses_cb_tagt_ses_new_coap_session (void)
 Create a dummy CoAP session control block. More...
 
void agt_ses_free_coap_session (ses_cb_t *scb)
 Free a dummy CoAP session control block. More...
 
ses_cb_tagt_ses_new_snmp_session (void)
 Create a dummy SNMP session control block. More...
 
void agt_ses_free_snmp_session (ses_cb_t *scb)
 Free a dummy snmp session control block. More...
 
ses_cb_tagt_ses_new_session (ses_transport_t transport, int fd)
 Create a real server session control block. More...
 
ses_cb_tagt_ses_new_session_tls (ses_transport_t transport, int fd, const char *client_addr)
 Create a real agent session control block for TLS. More...
 
void agt_ses_free_session (ses_cb_t *scb)
 Free a real session control block. More...
 
void agt_ses_free_session2 (ses_cb_t *scb, boolean clear_locks)
 Free a real session control block but with optional unlocking. More...
 
boolean agt_ses_session_id_valid (ses_id_t sid)
 Check if a session-id is for an active session. More...
 
boolean agt_ses_request_close (ses_cb_t *scb, ses_id_t killedby, ses_term_reason_t termreason)
 Start the close of the specified session. More...
 
void agt_ses_thread_kill_session (ses_cb_t *scb, ses_id_t killedby, ses_term_reason_t termreason)
 Kill the specified session; called from session thread. More...
 
void agt_ses_kill_session (ses_cb_t *scb, ses_id_t killedby, ses_term_reason_t termreason)
 Kill the specified session. More...
 
boolean agt_ses_process_first_ready_by_sid (ses_id_t sid)
 Check the readyQ and process the first message matching session, if any. More...
 
boolean agt_ses_process_first_ready (boolean ycontrol)
 Check the readyQ and process the first message, if any. More...
 
void agt_ses_check_timeouts (ses_id_t sid)
 Check if any sessions need to be dropped because they have been idle too long. More...
 
boolean agt_ses_ssh_port_allowed (uint16 port)
 Check if the port number used for SSH connect is okay. More...
 
void agt_ses_fill_writeset (fd_set *fdset, int *maxfdnum)
 Drain the ses_msg outreadyQ and set the specified fdset Used by agt_ncxserver write_fd_set. More...
 
status_t agt_ses_get_inSessions (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the inSessions counter More...
 
status_t agt_ses_get_inBadHellos (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the inBadHellos counter More...
 
status_t agt_ses_get_inRpcs (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the inRpcs counter More...
 
status_t agt_ses_get_inBadRpcs (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the inBadRpcs counter More...
 
status_t agt_ses_get_outRpcErrors (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the outRpcErrors counter More...
 
status_t agt_ses_get_outNotifications (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the outNotifications counter More...
 
status_t agt_ses_get_droppedSessions (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the droppedSessions counter More...
 
status_t agt_ses_get_session_inRpcs (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the session/inRpcs counter More...
 
status_t agt_ses_get_session_inBadRpcs (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the inBadRpcs counter More...
 
status_t agt_ses_get_session_outRpcErrors (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the outRpcErrors counter More...
 
status_t agt_ses_get_session_outNotifications (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 <get> operation handler for the outNotifications counter More...
 
void agt_ses_invalidate_session_acm_caches (void)
 Invalidate all session ACM caches so they will be rebuilt. More...
 
ses_cb_tagt_ses_get_session_for_id (ses_id_t sid)
 get the session for the supplied sid More...
 
uint32 agt_ses_mgmt_session_count (void)
 Get number of management sessions open. More...
 
void agt_ses_go_active (void)
 Activate MGMT sessions because YP-HA mode is active. More...
 
void agt_ses_go_standby (void)
 Deactivate MGMT sessions because YP-HA mode is standby. More...
 
void agt_ses_remove_subsys (ses_id_t sid)
 Remove a subsystem session for an HA Standby. More...
 
boolean agt_ses_max_cli_sessions (void)
 Check if max-cli-sessions parameter has been reached. More...
 
boolean agt_ses_max_user_sessions (const xmlChar *user)
 Check if max-user-sessions parameter has been reached. More...
 
void agt_ses_set_max_sessions (uint16 val)
 Set the max-sessions parameter. More...
 
void agt_ses_set_max_cli_sessions (uint16 val)
 Set the max-cli-sessions parameter. More...
 
void agt_ses_set_max_user_sessions (uint16 val)
 Set the max-user-sessions parameter. More...
 
void agt_ses_set_hello_timeout (uint32 val)
 Set the hello-timeout parameter. More...
 
void agt_ses_set_idle_timeout (uint32 val)
 Set the idle-timeout parameter. More...
 

Detailed Description

Server sessions are allocated in order connect request received.

A ses_cb_t is created using NCX session support in ses.c. Session IO and connection state is held in this control block.

Function Documentation

◆ agt_ses_check_timeouts()

void agt_ses_check_timeouts ( ses_id_t  sid)

Check if any sessions need to be dropped because they have been idle too long.

Parameters
sidsession ID to check
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_cleanup()

void agt_ses_cleanup ( void  )

Cleanup the session manager module data structures.

Called by the server during shutdown.

Here is the call graph for this function:

◆ agt_ses_fill_writeset()

void agt_ses_fill_writeset ( fd_set *  fdset,
int *  maxfdnum 
)

Drain the ses_msg outreadyQ and set the specified fdset Used by agt_ncxserver write_fd_set.

Parameters
[out]fdsetpointer to fd_set to fill
*fdset is updated in
[out]maxfdnumpointer to max fd int to fill in
*maxfdnum may be updated
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_free_coap_session()

void agt_ses_free_coap_session ( ses_cb_t scb)

Free a dummy CoAP session control block.

Parameters
scbsession control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_free_dummy_session()

void agt_ses_free_dummy_session ( ses_cb_t scb)

Free a dummy session control block.

Parameters
scbsession control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_free_session()

void agt_ses_free_session ( ses_cb_t scb)

Free a real session control block.

Parameters
scbsession control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_free_session2()

void agt_ses_free_session2 ( ses_cb_t scb,
boolean  clear_locks 
)

Free a real session control block but with optional unlocking.

Parameters
scbsession control block to free
clear_locksTRUE if need to release locks
FALSE; otherwise. Only For THREADED version
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_free_snmp_session()

void agt_ses_free_snmp_session ( ses_cb_t scb)

Free a dummy snmp session control block.

Parameters
scbsession control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_get_droppedSessions()

status_t agt_ses_get_droppedSessions ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the droppedSessions counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_inBadHellos()

status_t agt_ses_get_inBadHellos ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the inBadHellos counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_inBadRpcs()

status_t agt_ses_get_inBadRpcs ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the inBadRpcs counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_inRpcs()

status_t agt_ses_get_inRpcs ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the inRpcs counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_inSessions()

status_t agt_ses_get_inSessions ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the inSessions counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_outNotifications()

status_t agt_ses_get_outNotifications ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the outNotifications counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_outRpcErrors()

status_t agt_ses_get_outRpcErrors ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the outRpcErrors counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_session_for_id()

ses_cb_t * agt_ses_get_session_for_id ( ses_id_t  sid)

get the session for the supplied sid

Parameters
sidthe id of the session to get
Returns
ses_cb_t* or NULL
Here is the caller graph for this function:

◆ agt_ses_get_session_inBadRpcs()

status_t agt_ses_get_session_inBadRpcs ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the inBadRpcs counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_session_inRpcs()

status_t agt_ses_get_session_inRpcs ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the session/inRpcs counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_session_outNotifications()

status_t agt_ses_get_session_outNotifications ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the outNotifications counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_get_session_outRpcErrors()

status_t agt_ses_get_session_outRpcErrors ( ses_cb_t scb,
getcb_mode_t  cbmode,
const val_value_t virval,
val_value_t dstval 
)

<get> operation handler for the outRpcErrors counter

Parameters
scbsession that issued the get (may be NULL) can be used for access control purposes
cbmodereason for the callback
virvalplace-holder node in the data model for this virtual value node
[out]dstvalpointer to value output struct
*dstval should be filled in, depending on the callback reason
Returns
status

◆ agt_ses_go_active()

void agt_ses_go_active ( void  )

Activate MGMT sessions because YP-HA mode is active.

Enabled if –ha-enabled=true

◆ agt_ses_go_standby()

void agt_ses_go_standby ( void  )

Deactivate MGMT sessions because YP-HA mode is standby.

Enabled if –ha-enabled=true

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_init()

status_t agt_ses_init ( void  )

INIT 1: Initialize the session manager module data structures.

Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_invalidate_session_acm_caches()

void agt_ses_invalidate_session_acm_caches ( void  )

Invalidate all session ACM caches so they will be rebuilt.

TBD:: optimize and figure out exactly what needs to change

Here is the call graph for this function:

◆ agt_ses_kill_session()

void agt_ses_kill_session ( ses_cb_t scb,
ses_id_t  killedby,
ses_term_reason_t  termreason 
)

Kill the specified session.

Parameters
scbthe session to close
killedbysession ID executing the kill-session or close-session
termreasontermination reason code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_max_cli_sessions()

boolean agt_ses_max_cli_sessions ( void  )

Check if max-cli-sessions parameter has been reached.

Returns
TRUE if max-cli-sessions reached; FALSE if limit not reached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_max_user_sessions()

boolean agt_ses_max_user_sessions ( const xmlChar *  user)

Check if max-user-sessions parameter has been reached.

Parameters
userusername to check limit for
Returns
TRUE if max-user-sessions reached; FALSE if limit not reached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_mgmt_session_count()

uint32 agt_ses_mgmt_session_count ( void  )

Get number of management sessions open.

Returns
number of management sessions open

◆ agt_ses_new_coap_session()

ses_cb_t * agt_ses_new_coap_session ( void  )

Create a dummy CoAP session control block.

Returns
pointer to initialized CoAP SCB, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_new_dummy_session()

ses_cb_t * agt_ses_new_dummy_session ( void  )

Create a dummy session control block.

Returns
pointer to initialized dummy SCB, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_new_session()

ses_cb_t * agt_ses_new_session ( ses_transport_t  transport,
int  fd 
)

Create a real server session control block.

Parameters
transportthe transport type
fdfile descriptor number to use for IO
Returns
pointer to initialized SCB, or NULL if some error. This pointer is stored in the session table, so it does not have to be saved by the caller
Here is the caller graph for this function:

◆ agt_ses_new_session_tls()

ses_cb_t * agt_ses_new_session_tls ( ses_transport_t  transport,
int  fd,
const char *  client_addr 
)

Create a real agent session control block for TLS.

WILL CLOSE fd IF SOME ERROR AND NULL IS RETURNED Assumes netconf-tls protocol!

Parameters
transportthe transport type
fdfile descriptor number to use for IO
client_addrclient address converted to string
Returns
pointer to initialized SCB, or NULL if some error. This pointer is stored in the session table, so it does not have to be saved by the caller
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_new_snmp_session()

ses_cb_t * agt_ses_new_snmp_session ( void  )

Create a dummy SNMP session control block.

Returns
pointer to initialized CoAP SCB, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_process_first_ready()

boolean agt_ses_process_first_ready ( boolean  ycontrol)

Check the readyQ and process the first message, if any.

Parameters
ycontrolTRUE if only YControl sessions should be processed
FALSE to process any session type
Returns
TRUE if a message was processed
FALSE if the readyQ was empty
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_process_first_ready_by_sid()

boolean agt_ses_process_first_ready_by_sid ( ses_id_t  sid)

Check the readyQ and process the first message matching session, if any.

Parameters
sidsession ID to process
Returns
TRUE if a message was processed
FALSE if the readyQ was empty
Here is the call graph for this function:

◆ agt_ses_remove_subsys()

void agt_ses_remove_subsys ( ses_id_t  sid)

Remove a subsystem session for an HA Standby.

Enabled if –ha-enabled=true

Parameters
sidsession ID of the subsystem session to remove and close
Here is the call graph for this function:

◆ agt_ses_request_close()

boolean agt_ses_request_close ( ses_cb_t scb,
ses_id_t  killedby,
ses_term_reason_t  termreason 
)

Start the close of the specified session.

Parameters
scbthe session to close
killedbysession ID executing the kill-session or close-session
termreasontermination reason code
Returns
TRUE if scb is still valid; FALSE if it was already freed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_session_id_valid()

boolean agt_ses_session_id_valid ( ses_id_t  sid)

Check if a session-id is for an active session.

Parameters
sidsession ID to check
Returns
TRUE if active session; FALSE otherwise

◆ agt_ses_set_dummy_session_acm()

status_t agt_ses_set_dummy_session_acm ( ses_cb_t dummy_session,
ses_id_t  use_sid 
)

Set the session ID and username of the user that will be responsible for the rollback if needed.

Parameters
dummy_sessionsession control block to change
use_sidSession ID to use for the rollback
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_set_dummy_session_tcb()

status_t agt_ses_set_dummy_session_tcb ( ses_cb_t dummy_session,
ses_id_t  use_sid 
)

Set the session TCB if needed.

Must call agt_ses_new_dummy_session first

Parameters
dummy_sessionsession control block to change
use_sidSession ID to use for the rollback
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_set_hello_timeout()

void agt_ses_set_hello_timeout ( uint32  val)

Set the hello-timeout parameter.

Parameters
valvalue to use
Here is the call graph for this function:

◆ agt_ses_set_idle_timeout()

void agt_ses_set_idle_timeout ( uint32  val)

Set the idle-timeout parameter.

Parameters
valvalue to use
Here is the call graph for this function:

◆ agt_ses_set_max_cli_sessions()

void agt_ses_set_max_cli_sessions ( uint16  val)

Set the max-cli-sessions parameter.

Parameters
valvalue to use
Here is the call graph for this function:

◆ agt_ses_set_max_sessions()

void agt_ses_set_max_sessions ( uint16  val)

Set the max-sessions parameter.

Parameters
valvalue to use
Here is the call graph for this function:

◆ agt_ses_set_max_user_sessions()

void agt_ses_set_max_user_sessions ( uint16  val)

Set the max-user-sessions parameter.

Parameters
valvalue to use
Here is the call graph for this function:

◆ agt_ses_ssh_port_allowed()

boolean agt_ses_ssh_port_allowed ( uint16  port)

Check if the port number used for SSH connect is okay.

Parameters
portport number to check
Returns
TRUE if port allowed
FALSE if port not allowed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ses_thread_kill_session()

void agt_ses_thread_kill_session ( ses_cb_t scb,
ses_id_t  killedby,
ses_term_reason_t  termreason 
)

Kill the specified session; called from session thread.

Parameters
scbsession control block
killedbysession ID executing the kill-session or close-session
termreasontermination reason code
Here is the call graph for this function: