src.dualinventive.com/mtinfo/tcpserver/legacy/lib/include/di-util/cp3000-ipc.h

83 lines
1.9 KiB
C

/*
************************************************************************
**
** Copyright (c) 2010 by
** Core|Vision B.V.
** Cereslaan 10b
** 5384 VT Heesch
** The Netherlands
**
** All Rights Reserved
**
************************************************************************
*/
/*
************************************************************************
**
** Project name: Dual Inventive: Utility Library
** Filename: cp3000-ipc.h
** Author: Jack Weeland
** Date: February 3, 2010
** File version: 1.00 of February 3, 2010
**
************************************************************************
*/
/*
************************************************************************
**
** CP3000 interprocess communication
**
** High level functions:
** - Create a server IPC socket, accept clients
** - Create a client IPC socket
**
** The read and write functions are transparent for both TCP and IPC
** sockets.
**
************************************************************************
*/
#ifndef __CP3000_IPC_H
#define __CP3000_IPC_H
#include <di-util/cp3000.h>
/*
** Server side
*/
// Initialize IPC server. Creates a Unix server socket for interprocess
// communication.
// Parameters:
// A cp3000_device_t object
// id - Name of the fifo
// Remarks:
// - Clients are accepted by cp3000_accept_client().
// - The path to the fifo is stored in the configuration (CFG_FIFO_DIR)
// - SSL maybe overkill on a Unix socket
int cp3000_init_ipc_server(
cp3000_device_t,
const char *id
);
/*
** Client side
*/
// Connect to a server
// The function 'cp3000_init_connection()' must be called after this function.
// Parameters:
// A cp3000_device_t object
// id - Name of the fifo
// Returns:
// 0 on success, -1 on error
// Remarks:
// - The path to the fifo is stored in the configuration (CFG_FIFO_DIR)
// - SSL maybe overkill on a Unix socket
int cp3000_connect_to_ipc_server(
cp3000_device_t,
const char *id
);
#endif /* __CP3000_IPC_H */