#include "opengatemd.h"
-
#define MAXFDCOUNT 10
/* data for select fds */
/***************************************
get a data from udp port
non-blocking read
-return=received bytes, 0=no data
+return=received bytes (0=no data)
use in polling loop
-in: buf=buffer, bufLen=buffer length
-out: clientIpAddress=client ip address
+in: buf=read buffer, bufLen=buffer length
+out: buf=acquired string, clientIpAddress=client ip address
***************************************/
int getDataFromUdpPort(char* buf, int bufLen, char* clientIpAddress){
addr_len = sizeof client_addr;
if((numbytes = recvfrom(sockfd, buf, bufLen-1 , 0,
(struct sockaddr *)&client_addr, &addr_len)) > 0) {
- buf[numbytes] = '\0'; /* null char to terminate string */
+ buf[numbytes] = '\0'; /* to terminate string */
inet_ntop(client_addr.ss_family,
get_in_addr((struct sockaddr *)&client_addr),
clientIpAddress, ADDRMAXLN);
return numbytes;
}
-/*************************
- the udp client connected is trusted or not
-*************************/
+/*********************************
+is the udp client trusted
+(the address is found in the trusted client list in conf file)
+*********************************/
int isUdpClientTrusted(char* clientIpAddress){
char* ipAddressInConf=NULL;
return found;
}
-/************************************
-is the ip address localhost
-************************************/
+/**************************************************
+is the address equal to the one of localhost
+**************************************************/
int isMyIpAddress(char* ipAddress){
struct ifaddrs * ifAddrStruct=NULL;
struct ifaddrs * ifa=NULL;
}
/***************************************
-Set a socket as asynchronous IO mode
+Set the socket to the asynchronous IO mode
***************************************/
int enableAsyncIo(int sockfd, void (*handler)(int))
{