defs/si_sha/autobrg.h File Reference

Automation bridge controller base class. More...

#include <si_sha/abrgcmn.h>
#include <unistd.h>
#include <pthread.h>

Go to the source code of this file.

Classes

struct  sc_automationBridgeConnection
 Represents a connection to an automation bridge controller. More...
struct  sc_automationBridge_vtable
 V-table for derived class functions. More...
struct  sc_automationBridgeBase
 Automation Bridge Base class. More...

Typedefs

typedef struct
sc_automationBridgeBase 
sc_automationBridgeBase
typedef sc_status(* sc_automationBridge_serviceDeviceF )(void *br, sc_automationPacket *pkt)
typedef sc_status(* sc_automationBridge_processRequestF )(void *br, sc_automationBridgeConnection *pc, sc_automationRequest *req, sc_automationResponse *res)

Functions

 sm_ptrhDecl (sc_automationBridgeConnection)
 Macro declares sc_automationBridgeConnectionPtrh, a pointer-handle to a bridge connection.
 sm_listDecl (sc_automationBridgeConnectionPtrh)
 Macro declares sc_automationBridgeConnectionPtrhList, a list of pointer-handles to a bridge connection.
sc_status sc_automationBridgeConnection_new (sc_automationBridgeBase *pb, int fd, sc_automationBridgeConnectionPtrh *conn)
sc_status sc_automationBridgeConnection_open (sc_automationBridgeConnection *pc)
sc_status sc_automationBridgeConnection_close (sc_automationBridgeConnection *pc)
sc_status sc_automationBridgeBase_construct (sc_automationBridgeBase *pb, const TCHAR *name, const TCHAR *basePath, s_uint32 pktSize, s_uint32 pktPoolSize, const sc_automationBridge_vtable *vtbl, void *instance)
sc_status sc_automationBridgeBase_start (sc_automationBridgeBase *pb)
sc_status sc_automationBridgeBase_stop (sc_automationBridgeBase *pb)
sc_status sc_automationBridgeBase_destruct (sc_automationBridgeBase *pb)


Detailed Description

Automation bridge controller base class.

The automation bridge base class makes it easier to be a bridge controller in LASE by implementing many of the common boiler plate things nearly all bridges have to do, such as spin a thread to listen for activity on the network, as well as from the script side.


Typedef Documentation

Function signature for derived class processRequest function

typedef sc_status(* sc_automationBridge_serviceDeviceF)(void *br, sc_automationPacket *pkt)

Function signature for derived class serviceDevice function


Function Documentation

sc_status sc_automationBridgeBase_construct ( sc_automationBridgeBase pb,
const TCHAR *  name,
const TCHAR *  basePath,
s_uint32  pktSize,
s_uint32  pktPoolSize,
const sc_automationBridge_vtable vtbl,
void *  instance 
)

Constructs an automation bridge controller base class.

Parameters:
[in,out] pb The bridge base member to construct.
[in] name The exposed name of the bridge
[in] basePath The base path of the system.
[in] pktSize The max size of packets on the network.
[in] pktPoolSize The initial size of packet pool.
[in] vtbl The derived class v-table.
[in] instance The address of the derived class instance.
Note:
When calling derived class functions via the v-table, the derived instance address is given as 'this' (first parameter).

sc_status sc_automationBridgeBase_destruct ( sc_automationBridgeBase pb  ) 

Destructs the bridge controller base.

Parameters:
[in,out] pb The bridge base member address.

sc_status sc_automationBridgeBase_start ( sc_automationBridgeBase pb  ) 

Starts the bridge controller service thread.

Parameters:
[in,out] pb The bridge base instance.

sc_status sc_automationBridgeBase_stop ( sc_automationBridgeBase pb  ) 

Stops the bridge controller service thread.

Parameters:
[in,out] pb The bridge base instance.

sc_status sc_automationBridgeConnection_close ( sc_automationBridgeConnection pc  ) 

Signals the connection thread to close the connection and exit.

This waits for the connection thread to exit.

Parameters:
[in,out] pc The connection to close.

sc_status sc_automationBridgeConnection_new ( sc_automationBridgeBase pb,
int  fd,
sc_automationBridgeConnectionPtrh *  conn 
)

Create a new connection object with the given socket.

Parameters:
[in,out] pb Bridge base device.
[in] fd Socket that the connection is on.
[out] conn The pointer-handle the new connection is assigned to.

sc_status sc_automationBridgeConnection_open ( sc_automationBridgeConnection pc  ) 

Creates a new thread to handle the connection.

Parameters:
[in,out] pc The connection to handle.


doxygen