SolarCapture C Bindings User Guide  SF-115721-CD
Issue 1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
session.h File Reference

sc_session: A set of threads and other objects. More...

Data Structures

struct  sc_session_error
 A SolarCapture session error object returned by sc_session_error_get. More...
 

Functions

int sc_session_alloc (struct sc_session **scs_out, const struct sc_attr *attr)
 Allocate a SolarCapture session. More...
 
int sc_session_prepare (struct sc_session *scs)
 Prepare a SolarCapture session. More...
 
int sc_session_go (struct sc_session *scs)
 Start a SolarCapture session. More...
 
int sc_session_pause (struct sc_session *scs)
 Pause a SolarCapture session. More...
 
struct sc_session_errorsc_session_error_get (struct sc_session *scs)
 Returns an error from a SolarCapture session. More...
 
void sc_session_error_free (struct sc_session *scs, struct sc_session_error *err)
 Frees an error object. More...
 

Detailed Description

sc_session: A set of threads and other objects.

Function Documentation

int sc_session_alloc ( struct sc_session **  scs_out,
const struct sc_attr attr 
)

Allocate a SolarCapture session.

Parameters
scs_outThe allocated session object is returned here
attrAttributes for the new session
Returns
0 on success, or a negative error code.

This function allocates a SolarCapture session.

A session comprises a set of threads, VIs, nodes and/or other SolarCapture objects.

void sc_session_error_free ( struct sc_session *  scs,
struct sc_session_error err 
)

Frees an error object.

Parameters
scsThe session
errThe error

Frees a sc_session_error pointer returned by sc_session_error_get.

struct sc_session_error* sc_session_error_get ( struct sc_session *  scs)

Returns an error from a SolarCapture session.

Parameters
scsThe session
Returns
A pointer to a sc_session_error struct representing the error encountered by session scs. The caller should pass the pointer to sc_session_error_free once once done with it.
If no error has occurred, this function returns NULL.
int sc_session_go ( struct sc_session *  scs)

Start a SolarCapture session.

Parameters
scsThe session
Returns
0 on success, or a negative error code.

Prepare the session scs (if necessary) and start the managed threads. This is usually called just once, after allocating resources. It can also be called after sc_session_pause() to restart a paused session.

int sc_session_pause ( struct sc_session *  scs)

Pause a SolarCapture session.

Parameters
scsThe session
Returns
0 on success, or a negative error code.

Pause the threads managed by session scs.

int sc_session_prepare ( struct sc_session *  scs)

Prepare a SolarCapture session.

Parameters
scsThe session
Returns
0 on success, or a negative error code.

Prepare the session scs. This step includes finalising resource allocations, preparing nodes, and starting packet capture. Managed threads are started in the "paused" state.

Note that although packet capture is started, you may get packet loss if the threads managing 'sc_vi's are not started soon afterwards.

Call sc_session_go() to start the managed threads and begin packet processing.