OSDN Git Service

modified comments
[opengatem/opengatem.git] / mdsrc / udpserv.c
index cf65ceb..8417274 100644 (file)
@@ -35,7 +35,6 @@ Email: watanaby@is.saga-u.ac.jp
 
 #include "opengatemd.h"
 
-
 #define MAXFDCOUNT 10
 
 /* data for select fds */
@@ -127,10 +126,10 @@ int prepareUdpPort(void (*handler)(int)){
 /***************************************
 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){
 
@@ -167,7 +166,7 @@ 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);
@@ -182,9 +181,10 @@ int getDataFromUdpPort(char* buf, int bufLen, char* clientIpAddress){
   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;
@@ -213,9 +213,9 @@ int isUdpClientTrusted(char* clientIpAddress){
   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;
@@ -265,7 +265,7 @@ int isMyIpAddress(char* ipAddress){
 }
 
 /***************************************
-Set a socket as asynchronous IO mode
+Set the socket to the asynchronous IO mode
 ***************************************/
 int enableAsyncIo(int sockfd, void (*handler)(int))
 {