liberipc/src/eripcclient.c File Reference

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "eripc.h"
#include "eripclog.h"
#include "eripcprivate.h"
#include "eripcclient.h"

Go to the source code of this file.

Functions

int erIpcSndCommand (erClientChannel_t channel, erIpcCmd_t *cmd)
int erIpcSndMessage (erClientChannel_t channel, char *szMsg)


Function Documentation

int erIpcSndCommand ( erClientChannel_t  channel,
erIpcCmd_t cmd 
)

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

Definition at line 39 of file eripcclient.c.

00040 {
00041     char    szBuffer[TB_MAXCHARONLINE];
00042     int     i;
00043     int     len;
00044 
00045     if (channel == NULL  ||  cmd == NULL)
00046     {
00047         ERIPC_ERRORPRINTF("Illegal parameters: channel [%p] cmd [%p]", channel, cmd);
00048         return -1;
00049     }
00050 
00051     snprintf(szBuffer, sizeof(szBuffer), "%d", cmd->cc);
00052 
00053     for (i = 0; i < cmd->nArg; i++)
00054     {
00055         len = strlen(szBuffer);
00056         snprintf(szBuffer + len, sizeof(szBuffer) - len, ",%s", cmd->arg[i]);
00057     }
00058     return erIpcSndMessage(channel, szBuffer);
00059 }

Here is the call graph for this function:

int erIpcSndMessage ( erClientChannel_t  channel,
char *  szMsg 
)

Definition at line 61 of file eripcclient.c.

00062 {
00063     int     sockfd;
00064     struct sockaddr_in serverAdr;
00065     erInternalClientChannel_t *clientChannel;
00066 
00067     if (channel == NULL  ||  szMsg == NULL)
00068     {
00069         ERIPC_ERRORPRINTF("Illegal parameters: channel [%p] szMsg [%p]", channel, szMsg);
00070         return -1;
00071     }
00072 
00073     clientChannel = (erInternalClientChannel_t *) channel;
00074     sockfd = clientChannel->sockfd;
00075     serverAdr = clientChannel->serverAdr;
00076 
00077     sendto(sockfd, szMsg, strlen(szMsg), 0, (struct sockaddr *) &serverAdr, sizeof(serverAdr));
00078     return 0;
00079 }


Generated on Sun Dec 14 17:11:41 2008 by  doxygen 1.5.6