#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"
Go to the source code of this file.
Classes | |
struct | erIpcCmd_t |
Defines | |
#define | TB_MAXCHARONLINE 1024 |
#define | TB_CMD_NAME 128 |
#define | TB_ARGLENGTH 256 |
#define | TB_N_ARG 6 |
Functions | |
int | erIpcSndMessage (erClientChannel_t channel, char *szMsg) |
int | erIpcSndCommand (erClientChannel_t channel, erIpcCmd_t *cmd) |
#define TB_ARGLENGTH 256 |
Definition at line 46 of file eripcclient.h.
#define TB_CMD_NAME 128 |
Definition at line 45 of file eripcclient.h.
#define TB_MAXCHARONLINE 1024 |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition at line 43 of file eripcclient.h.
#define TB_N_ARG 6 |
Definition at line 47 of file eripcclient.h.
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 }
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 }