smtk::client Class Reference

SmTk client. More...

Inheritance diagram for smtk::client:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int add_to_shm_group (const char *shm_group_name, const char **shm_list, const struct remote_shm *remote=0, char **response=0)
 add shared memory objects to an existing network shared memory group
 client (const char *address_port=0)
 client connected to a SmTk server
int connect (const char *group_name, const char *address_port_1, const char *address_port_2, const struct remote_shm *remote=0, char **response=0)
 make a connection link two remote servers
int connect (const char *group_name, const char *address_port, const struct remote_shm *remote=0, char **response=0)
 make a connection link from the client's server to a remote server
int create_net_group (const char *group_name, NET_TYPO typo=FULLY_CONNECTED, MODE mode=GET, char **response=0)
 make a network group
int create_shm_group (const char *shm_group_name, const char *net_group_name=0, const char *shm_name=0, const char *arena_filename=0, COM_TYPE com=TCP, const char **shm_list=0, const struct remote_shm *remote=0, char **response=0)
 create a network shared memory group
int destroy_net_group (const char *group_name, bool all_servers=true, char **response=0)
 destroy a network group
int destroy_shm_group (const char *shm_group_name, bool all_servers=false, char **response=0)
 destroy a shared memory group
int disconnect (const char *group_name, const char *address_port_1, const char *address_port_2=0, char **response=0)
 unmake a connection between two remote servers
char * get_remote_address (void) const
 get the server address and port as a string
bool is_invalid (void) const
 see if the object is invalid
bool is_valid (void) const
 see if the object is valid
int ping (char **response)
 exercise the socket connection
int remove_from_shm_group (const char *shm_group_name, const char **shm_list, char **response=0)
 remove shared memory objects from an existing network shared memory group
virtual ~client (void)
 destructor

Protected Member Functions

template<class T>
invalidate (T t)
 invalidate the object
void invalidate (void)
 invalidate the object
template<class T>
validate (T t)
 validate the object
void validate (void)
 validate the object

Detailed Description

SmTk client.

This provides an interface to the SmTk server. You may use smtk:client to send command and recieve messages to the SmTk server. This client will keep a socket connected to the server.


Constructor & Destructor Documentation

client::client ( const char *  address_port = 0  ) 

client connected to a SmTk server

Parameters:
address_port is the address and port of the SmTk server to connect to. The environment varable SMTK_CONNECTON, if set, will over-ride the value of address_port. If the address or port are not given the default a address and port will be used. The default address and port is defined as SMTK_DEFAULT_ADDRESS and SMTK_DEFAULT_PORT respectively in smtk/config.h.


Member Function Documentation

int client::add_to_shm_group ( const char *  shm_group_name,
const char **  shm_list,
const struct remote_shm *  remote = 0,
char **  response = 0 
)

add shared memory objects to an existing network shared memory group

Parameters:
shm_group_name is the name of the network shared memory group to add the shared memory objects to
shm_list is a zero terminated list of shared memory segments that will be written to
remote is a zero terminated array of structures that give different shared memory object names and arena filenames on remote servers that are in the network group. If no shared memory object names or arena filenames differ on remote servers this should be zero.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

int client::connect ( const char *  group_name,
const char *  address_port_1,
const char *  address_port_2,
const struct remote_shm *  remote = 0,
char **  response = 0 
)

make a connection link two remote servers

This version of link will make connections for a network group that has a new network topology that has a NET_TYPO of type TREE and the client's is not one of the servers in the link being requested.

Parameters:
group_name is the name of the network group to add the connection to
address_port_1 a the remote server address and port to connect to address_port_2.
address_port_2 a the remote server address and port to connect to address_port_1.
remote is a zero terminated structure that give different shared memory object names and arena filenames on remote server that are being added to the network group. If no shared memory object names or arena filenames differ on remote servers this should be zero.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

int client::connect ( const char *  group_name,
const char *  address_port,
const struct remote_shm *  remote = 0,
char **  response = 0 
)

make a connection link from the client's server to a remote server

Parameters:
group_name is the name of the network group to add the connection to
address_port is the remote server address and port.
remote is a zero terminated structure that give different shared memory object names and arena filenames on remote server that are being added to the network group. If no shared memory object names or arena filenames differ on remote servers remote should be zero.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

int client::create_net_group ( const char *  group_name,
NET_TYPO  typo = FULLY_CONNECTED,
MODE  mode = GET,
char **  response = 0 
)

make a network group

Parameters:
group_name is the name of the network group. This name is used to refer to this group by all servers in the group.
typo is the network server topology. This may be either FULLY_CONNECTED or TREE. If the typo is FULLY_CONNECTED then commands will be sent from one server to all connected servers. If the typo is TREE commands will be sent along all branches. Loops may not be made for the TREE case.
mode (creation mode flag) may be GET or CREATE. If mode is GET then the networked group will be created if it does not exist, else if mode is CREATE the networked group must not exist before this call and it will be created, of else there will be an error.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called.
Returns:
0 on success and 1 on error.

int client::create_shm_group ( const char *  shm_group_name,
const char *  net_group_name = 0,
const char *  shm_name = 0,
const char *  arena_filename = 0,
COM_TYPE  com = TCP,
const char **  shm_list = 0,
const struct remote_shm *  remote = 0,
char **  response = 0 
)

create a network shared memory group

In order to make this group all the shared memory objects must exist on the client's local system. The shared memory object with name shm_name must exist on the local servers system.

Parameters:
shm_group_name is the name of the network shared memory group to create
net_group_name is the name of the network group that will communicate the shared memory data. If net_group_name is zero, the name of the network group will be same as shm_group_name.
shm_name is the name of the master shared memory object that will be shared. The master shared memory object may be a regular shared memory segment or a shared memory message queue. The writing of the all the shared memory segments will be done when the master shared memory object is written. If shm_name is zero the name of the master shared memory object will be the same as the name of the network shared memory group.
arena_filename is the filename of the the master shared memory object's arena file. If this is zero the default arena file will be used.
com selects the under lying socket communication type for sharing the shared memory user data. com may be TCP or UDP.
shm_list is a zero terminated array of local shared memory object names that will be written to. When list is zero no other shared memory objects that will be written to when the master shared memory object is written to.
remote is a zero terminated array of structures that give different shared memory segement names and arena filenames on remote servers that are in the network group. If no shared memory segement names or arena filenames differ on remote servers this should be zero.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

int client::destroy_net_group ( const char *  group_name,
bool  all_servers = true,
char **  response = 0 
)

destroy a network group

This will destroy a network group and all shared memory object groups that use the network group on all servers that are in the network group.

Parameters:
group_name is the name of the network group.
all_servers if true the group will be reomoved on all servers that are in the connection topology. If all_servers is false the group will be destroyed on just the server that this client is connected to.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called.
Returns:
0 on success and 1 on error.

int client::destroy_shm_group ( const char *  shm_group_name,
bool  all_servers = false,
char **  response = 0 
)

destroy a shared memory group

Destroys the shared memory group.

Parameters:
shm_group_name is the name of the shared memory object group to destroy
all_servers is true than the shared memory object group will be destroyed on all servers that the shared memory object groups network group is connected to, else if all_servers is false than the shared memory object group will be destroyed on just the local server.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

int client::disconnect ( const char *  group_name,
const char *  address_port_1,
const char *  address_port_2 = 0,
char **  response = 0 
)

unmake a connection between two remote servers

This will remove the connection (link) between the two servers at the addresses given, address_port_1 and address_port_2.

Parameters:
group_name is the name of the network group to remove the connection from
address_port_1 removes the link from address_port_1 to address_port_2
address_port_2 removes the link from address_port_1 to address_port_2. If address_port_2 is zero then all connections to the server at address_port_1 will be removed.
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

char* smtk::client::get_remote_address ( void   )  const [inline]

get the server address and port as a string

Returns:
a pointer to a statically declared string.

template<class T>
T smtk::validation::invalidate ( t  )  [inline, protected, inherited]

invalidate the object

Make the object invalid.

Returns:
t the argument the user passed.

void smtk::validation::invalidate ( void   )  [inline, protected, inherited]

invalidate the object

Make the object invalid.

bool smtk::validation::is_invalid ( void   )  const [inline, inherited]

see if the object is invalid

Returns:
true if the object is invalid, and false if not.

bool smtk::validation::is_valid ( void   )  const [inline, inherited]

see if the object is valid

Returns:
true if the object is valid, and false if not.

int client::ping ( char **  response  ) 

exercise the socket connection

Parameters:
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called.
Returns:
0 on success and 1 on error.

int client::remove_from_shm_group ( const char *  shm_group_name,
const char **  shm_list,
char **  response = 0 
)

remove shared memory objects from an existing network shared memory group

Parameters:
shm_group_name is the name of the network shared memory group to remove the shared memory objects from
shm_list is a zero terminated list of shared memory segments that will be removed
response If response is set the value pointed to by *response will be set to a string that is part of this object and will be over-written in the next method called from this object.
Returns:
0 on success and 1 on error.

template<class T>
T smtk::validation::validate ( t  )  [inline, protected, inherited]

validate the object

Make the object valid.

Returns:
t the argument the user passed.

void smtk::validation::validate ( void   )  [inline, protected, inherited]

validate the object

Make the object valid.


The documentation for this class was generated from the following files:
Generated on Sat Aug 11 22:25:56 2007 for Simulation Toolkit (SmTk) by  doxygen 1.5.2