Skip to content

File wsh_shell_session.c

FileList > src > wsh_shell_session.c

Go to the source code of this file

  • #include "wsh_shell_session.h"

Public Functions

Type Name
void WshShellSession_Clear (WshShellSessionIO_t * pSessIO)
Drop any persisted session.
void WshShellSession_Init (WshShellSessionIO_t * pSessIO, WshShellSession_ReadHandler_t readFn, WshShellSession_WriteHandler_t writeFn)
Initialise the session system with custom I/O handlers.
WshShell_Bool_t WshShellSession_IsValid (const WshShellSession_t * pcSession)
Check whether a descriptor is a valid, active keep request.
WshShellSession_t WshShellSession_Read (WshShellSessionIO_t * pSessIO)
Read the persisted descriptor.
void WshShellSession_Store (WshShellSessionIO_t * pSessIO, WshShellSession_t session)
Persist a descriptor, computing its integrity hash first.

Public Functions Documentation

function WshShellSession_Clear

Drop any persisted session.

1
2
3
void WshShellSession_Clear (
    WshShellSessionIO_t * pSessIO
) 

Parameters:

  • pSessIO Pointer to the I/O structure.

function WshShellSession_Init

Initialise the session system with custom I/O handlers.

1
2
3
4
5
void WshShellSession_Init (
    WshShellSessionIO_t * pSessIO,
    WshShellSession_ReadHandler_t readFn,
    WshShellSession_WriteHandler_t writeFn
) 

Installs the handlers and normalises the backing store: any invalid descriptor (e.g. random RAM after a cold boot) is cleared so it will not be restored.

Parameters:

  • pSessIO Pointer to the I/O structure.
  • readFn Callback to read the saved descriptor.
  • writeFn Callback to persist the descriptor.

function WshShellSession_IsValid

Check whether a descriptor is a valid, active keep request.

1
2
3
WshShell_Bool_t WshShellSession_IsValid (
    const WshShellSession_t * pcSession
) 

Parameters:

  • pcSession Descriptor to validate.

Return value:

  • true Hash matches and RebootsLeft > 0.
  • false Corrupt/uninitialised, or budget exhausted.

function WshShellSession_Read

Read the persisted descriptor.

1
2
3
WshShellSession_t WshShellSession_Read (
    WshShellSessionIO_t * pSessIO
) 

Parameters:

  • pSessIO Pointer to the I/O structure.

Returns:

The stored descriptor (may be invalid — check with WshShellSession_IsValid()).


function WshShellSession_Store

Persist a descriptor, computing its integrity hash first.

1
2
3
4
void WshShellSession_Store (
    WshShellSessionIO_t * pSessIO,
    WshShellSession_t session
) 

Parameters:

  • pSessIO Pointer to the I/O structure.
  • session Descriptor to store (its Hash field is filled in).


The documentation for this class was generated from the following file src/wsh_shell_session.c