185 lines
5.9 KiB
C
185 lines
5.9 KiB
C
|
/***********************************************************************
|
||
|
*
|
||
|
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; version 2.1
|
||
|
* of the License.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library; if not, Novell, Inc.
|
||
|
*
|
||
|
* To contact Novell about this file by physical or electronic mail,
|
||
|
* you may find current contact information at www.novell.com.
|
||
|
*
|
||
|
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||
|
*
|
||
|
***********************************************************************/
|
||
|
|
||
|
#ifndef _IPCCLIENT_
|
||
|
#define _IPCCLIENT_
|
||
|
|
||
|
//===[ Header files specific to this module ]==============================
|
||
|
|
||
|
//===[ Manifest constants ]==============================
|
||
|
|
||
|
#ifndef IN
|
||
|
#define IN
|
||
|
#endif
|
||
|
#ifndef OUT
|
||
|
#define OUT
|
||
|
#endif
|
||
|
#ifndef INOUT
|
||
|
#define INOUT
|
||
|
#endif
|
||
|
|
||
|
//===[ Structure Definitions ]==============================
|
||
|
|
||
|
//===[ Function Prototypes ]==============================
|
||
|
|
||
|
|
||
|
//++=======================================================================
|
||
|
extern "C"
|
||
|
int
|
||
|
IpcClientInit(
|
||
|
IN char *pName,
|
||
|
IN bool multithreaded,
|
||
|
IN int debugLevel,
|
||
|
IN bool useSyslog);
|
||
|
//
|
||
|
// Arguments In: pName - Pointer to string containing the name that the
|
||
|
// calling application wants associated with the
|
||
|
// debug logs emitted by the library.
|
||
|
//
|
||
|
// multithreaded - Set to TRUE if the process is
|
||
|
// multithreaded.
|
||
|
//
|
||
|
// debugLevel - The level that the library should use for
|
||
|
// determining what information should be logged
|
||
|
// for debugging purposes. 0 being the lowest
|
||
|
// level.
|
||
|
//
|
||
|
// useSyslog - Set to TRUE to log debug statements using Syslog,
|
||
|
// else debugs are log to stderr.
|
||
|
//
|
||
|
// Arguments Out: None.
|
||
|
//
|
||
|
// Returns: 0 == Success
|
||
|
// -1 == Failure
|
||
|
//
|
||
|
// Abstract: Method to initialize the IPC infrastructure for process.
|
||
|
//
|
||
|
// Note: It is necessary to call the appropriate function to
|
||
|
// set the server address before a request can be submitted.
|
||
|
//
|
||
|
//=======================================================================--
|
||
|
|
||
|
|
||
|
//++=======================================================================
|
||
|
extern "C"
|
||
|
void
|
||
|
IpcClientShutdown(void);
|
||
|
//
|
||
|
// Arguments In: None.
|
||
|
//
|
||
|
// Arguments Out: None.
|
||
|
//
|
||
|
// Returns: 0 == Success
|
||
|
// -1 == Failure
|
||
|
//
|
||
|
// Abstract: Method to shutdown the IPC infrastructure for process.
|
||
|
//
|
||
|
//=======================================================================--
|
||
|
|
||
|
|
||
|
//++=======================================================================
|
||
|
extern "C"
|
||
|
int
|
||
|
IpcClientSetUnAddress(
|
||
|
IN char *pSocketFileName);
|
||
|
//
|
||
|
// Arguments In: pSocketFileName - Pointer to string containing the name
|
||
|
// of the socket file.
|
||
|
//
|
||
|
// Arguments Out: None.
|
||
|
//
|
||
|
// Returns: 0 == Success
|
||
|
// -1 == Failure
|
||
|
//
|
||
|
// Abstract: Method to set the socket file name to utilize for
|
||
|
// communicating with the server via DOMAIN sockets.
|
||
|
//
|
||
|
// Note: The service should have been initialized before calling
|
||
|
// this procedure.
|
||
|
//
|
||
|
//=======================================================================--
|
||
|
|
||
|
|
||
|
//++=======================================================================
|
||
|
extern "C"
|
||
|
int
|
||
|
IpcClientSetInAddress(
|
||
|
IN unsigned short int serverPort,
|
||
|
IN uint32_t serverAddress);
|
||
|
//
|
||
|
// Arguments In: serverPort - Server's listening port number.
|
||
|
//
|
||
|
// serverAddress - The server's IP Address. Use
|
||
|
// 0x7F000001 if the server is local.
|
||
|
//
|
||
|
// Arguments Out: None.
|
||
|
//
|
||
|
// Returns: 0 == Success
|
||
|
// -1 == Failure
|
||
|
//
|
||
|
// Abstract: Method to set the address to utilize for communicating
|
||
|
// with the server via TCP sockets.
|
||
|
//
|
||
|
// Note: The service should have been initialized before calling
|
||
|
// this procedure.
|
||
|
//
|
||
|
//=======================================================================--
|
||
|
|
||
|
|
||
|
//++=======================================================================
|
||
|
extern "C"
|
||
|
int
|
||
|
IpcClientSubmitReq(
|
||
|
IN char *pClientData,
|
||
|
IN int clientDataLen,
|
||
|
INOUT char **ppServerData,
|
||
|
INOUT int *pServerDataLen);
|
||
|
//
|
||
|
// Arguments In: pClientData - Pointer to client data that must be sent to
|
||
|
// the server. Buffer is NEVER released by the
|
||
|
// procedure.
|
||
|
//
|
||
|
// clientDataLen - Length of the client data.
|
||
|
//
|
||
|
// Arguments Out: ppServerData - Pointer to variable that will receive a
|
||
|
// pointer to the buffer containing the data
|
||
|
// received from the server.
|
||
|
//
|
||
|
// pServerDataLen - Pointer to variable that will receive the
|
||
|
// length of the data received from the server.
|
||
|
//
|
||
|
// Returns: 0 == Request completed gracefully
|
||
|
// -1 == Request did not complete gracefully
|
||
|
//
|
||
|
// Abstract: Method to submit a request.
|
||
|
//
|
||
|
// Note: The routine blocks until the request completes.
|
||
|
//
|
||
|
//=======================================================================--
|
||
|
|
||
|
#endif // _IPCCLIENT_
|
||
|
|
||
|
//=========================================================================
|
||
|
//=========================================================================
|