Main Page | Data Structures | File List | Data Fields | Globals

cctalk-client.c File Reference


Detailed Description

Provide a Unix socket client interface to the cctalk.

Author:
Rod Boyce
OK the comment I have said the the top of the server code still stands. Any way this module is going to be a library for the client to make cctalk calls.

Date:
20/10/04

#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include "cctalk-channel-defs.h"
#include "cctalk-operations.h"
#include "cctalk-channel.h"
#include "cctalk-pkts.h"
#include "cctalk-pkt-utls.h"
#include "cctalk-socket.h"

Include dependency graph for cctalk-client.c:

Include dependency graph

Functions

void cctalk_ch_Initialise (void)
 cctalk_ch_Initialise

teCCTALK_ERRORS cctc_SendCommandPacket (tsCCT_PKT_CHANNEL_CMD *sCctCmdPkt)
 Send a command packet to the cctalk server.

teCCTALK_ERRORS cctc_SendOperationPacket (tsCCTALK_OPERATION_PKT *psCctOpPkt)
 Send a cctalk operation packet to the server to be processed.

teCCTALK_ERRORS cctc_SentRxOpPkt (tsCCT_PKT_CHANNEL_CMD *psCctCmdPkt, tsCCTALK_OPERATION *psCctOp)
 Will request the server to send us any completed cctalk operation we sent to it.

teCCTALK_ERRORS cctc_ReceiveErrorPacket (void)
 Get an error packet from the server.

teCCTALK_ERRORS cctalk_UseSocket (char *pacSocketName)
 Called before open to use named socket instead of the default.

teCCTALK_ERRORS cctalk_OpenChannel (teCCTALK_CHANNEL eCctCh, teCCTALK_SPEED eCctSpd)
 Open a cctalk channel for communication.

teCCTALK_ERRORS cctalk_CloseChannel (teCCTALK_CHANNEL eCctCh)
 Called to close a cctalk channel.

teCCTALK_ERRORS cctalk_QueueOperation (teCCTALK_CHANNEL eCctCh, tsCCTALK_OPERATION *psCctOp)
 Called to perform cctalk transactions.

teCCTALK_ERRORS cctalk_ReceiveOperation (teCCTALK_CHANNEL eCctCh, tsCCTALK_OPERATION *psCctOp)
 Receive completed transactions from a cctalk channel.

teCCTALK_ERRORS cctalk_ChannelStatus (teCCTALK_CHANNEL eCctCh)
 Is there any cctalk operation for this channel.

teCCTALK_ERRORS cctalk_ForceCloseChannel (teCCTALK_CHANNEL eCctCh)
 Force closure for the cctalk channel.

teCCTALK_ERRORS cctalk_CommandServerToExit (void)
 Send a command to the server to tell it to Exit nicely.

char * cctalk_StrError (teCCTALK_ERRORS eCctError)
 Get error string based on error code.


Variables

int qIsInitialised = 0
char * pacCctErrorCodes []
char acCctalkSocket [100] = "/dev/cctalk"
int fdSock
unsigned char qIsChannelSocketInUse [eCCTALK_CHANNEL_END]
sockaddr_un sAddress
size_t zlAddrLength

Function Documentation

void cctalk_ch_Initialise void   )  [static]
 

cctalk_ch_Initialise

Initialise the client communication socket to closed.

Date:
26/10/04
Author:
Rod Boyce

History

teCCTALK_ERRORS cctalk_ChannelStatus teCCTALK_CHANNEL  eCctCh  ) 
 

Is there any cctalk operation for this channel.

This function is called to see if there are any cctalk operations either queued to be send to the cctalk device or waiting for the client to receive the completed cctalk operation.

Date:
05/11/04
Author:
Rod Boyce.
Parameters:
eCctCh - Channel to get the status of.
Returns:
eCCTALK_CH_BUSY if there is data waiting to be send or received and eCCTALK_CH_NO_DATA if there is no data waiting for this cctalk channel

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_CloseChannel teCCTALK_CHANNEL  eCctCh  ) 
 

Called to close a cctalk channel.

When a user has finished using a cctalk channel the close channel fn is called to close the channel. a check is made to confirm that all transactions have finished and the channel is then closed.

Date:
19/10/04
Author:
Rod Boyce
Parameters:
eCctCh - The channel to perform this action on.
Returns:

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_CommandServerToExit void   ) 
 

Send a command to the server to tell it to Exit nicely.

Date:
09/11/04
Author:
Rod Boyce
Returns:
eCCTALK_SUCESS is returned by the client when the channel is closed

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_ForceCloseChannel teCCTALK_CHANNEL  eCctCh  ) 
 

Force closure for the cctalk channel.

This code is called when the client want to force the closure of a cctalk channel. A message is sent to the server to force the closure of a cctalk channel.

Date:
05/11/04
Author:
Rod Boyce.
Parameters:
eCctCh - Channel to force closed.
Returns:
eCCTALK_SUCESS is returned by the client when the channel is closed

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_OpenChannel teCCTALK_CHANNEL  eCctCh,
teCCTALK_SPEED  eCctSpd
 

Open a cctalk channel for communication.

Open a cctalk channel for communication with the device(s) on this cctalk channel. There many be more than one device here. This routine is not concerned with auto discovery the devices must already be known on this channel.

Date:
19/10/04
Author:
Rod Boyce
Parameters:
eCctCh - The cctalk channel to open
eCctSpd - The speed to communication over this channel with
Returns:
see enum teCCTALK_ERRORS for error code definitions

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_QueueOperation teCCTALK_CHANNEL  eCctCh,
tsCCTALK_OPERATION psCctOp
 

Called to perform cctalk transactions.

A cctalk operation consists of a packet to transmit, a reply packet, the maximum size of the expected reply packet, how long to wait for the reply packet, and the size of the TX packet. The format of the packet can vary depending on, if an addition checksum, a CRC16 checksum, or if encryption is being used on the wire. This interface provides a conduit for transactions but the end developer must format the packets correctly.

Date:
19/10/04
Author:
Rod Boyce
Parameters:
eCctCh - The channel to perform the transaction on.
psCctOp - the cctalk transaction to perform
Returns:

History

Here is the call graph for this function:

teCCTALK_ERRORS cctalk_ReceiveOperation teCCTALK_CHANNEL  eCctCh,
tsCCTALK_OPERATION psCctOp
 

Receive completed transactions from a cctalk channel.

A call this is will return a cctalk transaction if one is available to be returned. This job of this function just got a lot more differcult as not only are we interested in the cctalk channel but also a socket handle.

Date:
19/10/04
Author:
Rod Boyce
Parameters:
eCctCh - The cctalk channel to check.
psCctOp - pointer to a cctalk op structure to return the operation in.
Returns:
The error code returned is found in teCCTALK_ERRORS.

History

Here is the call graph for this function:

char* cctalk_StrError teCCTALK_ERRORS  eCctError  ) 
 

Get error string based on error code.

Returns an error string describing the error code passed to this function

Date:
26/10/04
Author:
Rod Boyce
Parameters:
eCctError - The error code to process
Returns:
pointer to a string describing the error code

History

teCCTALK_ERRORS cctalk_UseSocket char *  pacSocketName  ) 
 

Called before open to use named socket instead of the default.

Called before opening a channel to set a device name other then the default socket. The socket is opened in client mode so the socket must exist before the client tried to open the socket.

Date:
08/11/04
Author:
Rod Boyce
Parameters:
pacSocketName - pointer to the device to open
Returns:
error code from teCCTALK_ERRORS.

History

teCCTALK_ERRORS cctc_ReceiveErrorPacket void   )  [static]
 

Get an error packet from the server.

After a command packet and a operation queue packet has been sent to the server we wait for an error packet to be sent back to indicate that the command completed successfully.

Date:
28/10/04
Author:
Rod Boyce
Returns:
error code defined in teCCTALK_ERRORS

History

Here is the call graph for this function:

teCCTALK_ERRORS cctc_SendCommandPacket tsCCT_PKT_CHANNEL_CMD psCctCmdPkt  )  [static]
 

Send a command packet to the cctalk server.

Send a command packet to the cctalk server and wait for the reply. Command packets are blocking they wait for a reply. Command packets are used to open a cctalk channel, close a cctalk channel or query status of the server.

Date:
22/10/04
Author:
Rod Boyce
Parameters:
sCctCmdPkt - pointer to the command packet to send
Returns:
An error code defined by the enum teCCTALK_ERRORS

History

Here is the call graph for this function:

teCCTALK_ERRORS cctc_SendOperationPacket tsCCTALK_OPERATION_PKT psCctOpPkt  )  [static]
 

Send a cctalk operation packet to the server to be processed.

Send a cctalk operation packet to the server to be queued

Date:
27/10/04
Author:
Rod Boyce
Parameters:
psCctCmdPkt - pointer to the operation packet to send to the server
Returns:
An error code defined by teCCTALK_ERRORS

History

Here is the call graph for this function:

teCCTALK_ERRORS cctc_SentRxOpPkt tsCCT_PKT_CHANNEL_CMD psCctCmdPkt,
tsCCTALK_OPERATION psCctOp
[static]
 

Will request the server to send us any completed cctalk operation we sent to it.

This function will send a message to the server to ask it to look for cctalk operations that were sent to it on this socket for the requested channel.

Date:
27/10/04
Author:
Rod Boyce
Parameters:
psCctCmdPkt - pointer to the command packet to send
psCctOp - pointer to the cctalk operation to store the data in.
Returns:
error code defined in teCTALK_ERRORS

History

Here is the call graph for this function:


Variable Documentation

char* pacCctErrorCodes[] [static]
 

Initial value:

{
    "eCCTALK_SUCCESS", "eCCTALK_CH_BUSY", "eCCTALK_CANNOT_OPEN",
    "eCCTALK_CH_NOT_OPEN", "eCCTALK_CH_NO_RPLY", "eCCTALK_CH_NO_DATA",
    "eCCTALK_CH_FAILED",

    "eCCTALK_END_OF_ERRORS"
}


Generated on Thu Jan 20 16:11:53 2005 for Axis cctalk sub-system by doxygen 1.3.6