nds2-client - ClientDeveloper  0.16.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
daqc_private.c File Reference
#include "daq_config.h"
#include "nds_logging.h"
#include "daqc_private.h"
#include "daqc_response.h"
Include dependency graph for daqc_private.c:

Macros

#define INVALID_SOCKET   -1
 
#define SHUT_RDWR   2
 

Functions

void daq_private_init (daq_private_t *Private)
 
void daq_private_create (daq_private_t **Private)
 
void daq_private_delete (daq_private_t **Private)
 
int daq_private_srvr_is_open (daq_private_t *Private)
 
int daq_private_srvr_nonblocking (daq_private_t *Private, int NonBlocking)
 Select non-blocking or blocking server socket I/O. More...
 
void daq_private_srvr_close (daq_private_t *Private)
 Close server socket. More...
 
int daq_private_srvr_connect (daq_private_t *Private)
 Connect to a server. More...
 
void daq_private_srvr_disconnect (daq_private_t *Private)
 
int daq_private_srvr_open (daq_private_t *Private)
 
int daq_private_data_close (daq_private_t *Private)
 

Macro Definition Documentation

#define INVALID_SOCKET   -1
#define SHUT_RDWR   2

Function Documentation

void daq_private_create ( daq_private_t **  Private)

Allocate a private structure AND the socket_addr_t element. Call daq_private_init to initialize the data elements.

Parameters
Privatepointer to receive new private structure address.
int daq_private_data_close ( daq_private_t Private)

Close the data socket. daq_private_data_close is protected against invalid Privte pointer of invalid (unopened) socket id.

void daq_private_delete ( daq_private_t **  Private)

Free the private data structure. Call daq_private_srvr_disconnect to free the socket address and then free the Private structure. The Private structure pointer is set to NULL. daq_private_delete is protected against a NULL Private structure pointer address or NULL structure pointer.

Parameters
PrivateAddress of private structure pointer.
void daq_private_init ( daq_private_t Private)

Initialize all fields of a pre-allocated private data structure. The socket numbers are initialized to INVALID_SOCKET and if the server address field is allocated (srvr_addr not NULL), it is zeroed.

Parameters
Privateis a pointer to the private structure to be initialized.
void daq_private_srvr_close ( daq_private_t Private)

Close server socket.

Shut down server socket connection and close the socket. Invlidate the socket number. daq_private_srvr_close IS protected against both invalid (NULL) Private pointer and socket number.

Parameters
PrivatePointer to private structure
int daq_private_srvr_connect ( daq_private_t Private)

Connect to a server.

Open a connection to the pre-specified server. The socket specified in sockfd is connected to the server whose address is specified in srvr_addr. No check is made for valid (non-NULL) private structure pointer or valid socket number.

Parameters
PrivatePointer to the private structure.
Returns
Error if non-zero.
void daq_private_srvr_disconnect ( daq_private_t Private)

Free the socket_addr_t storage and set pointer (srvr_addr) to NULL. daq_private_srvr_disconnect is protected against NULL pointers to the private structure and to the socket addr structure.

Parameters
Privateis a pointer to the Private structure to be disconnected.
int daq_private_srvr_is_open ( daq_private_t Private)

Test whether the server port is connected.

Parameters
Privateis a pointer to the private structure to be tested.
Returns
Non-zero if the server port is connected.
int daq_private_srvr_nonblocking ( daq_private_t Private,
int  NonBlocking 
)

Select non-blocking or blocking server socket I/O.

Set the server socket for blocking/non-blocking I/O. If the NonBlocking argument is non-zero, the socket is set for non-blocking I/O. If it is zero, the socket is set to block.

Note
Not protected against invalid Private pointer (NULL) or socket.
Parameters
PrivatePrivate structure pointer.
NonBlockingSelect Blocking/Non-Blocking I/O.
Returns
Zero if previously blocking I/O.
int daq_private_srvr_open ( daq_private_t Private)

Allocate an internet stream (tcp) socket to communicate with a server. Set socket to allow reuse.