added the setclientmac function

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@82 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2012-01-10 13:41:53 +00:00
parent 1a85d9f691
commit ef65cc8b54
2 changed files with 17 additions and 3 deletions

View File

@ -4920,13 +4920,27 @@ char* slsDetector::setClientIP(string clientIP){
struct sockaddr_in sa;
int result = inet_pton(AF_INET, clientIP.c_str(), &(sa.sin_addr));
if((!result)||(clientIP.length()>15))
sprintf(thisDetector->clientIP,"IP Address should be VALID and in xxx.xxx.xxx.xxx format");
return ("IP Address should be VALID and in xxx.xxx.xxx.xxx format");
else
sprintf(thisDetector->clientIP,clientIP.c_str());
return thisDetector->clientIP;
};
char* slsDetector::setClientMAC(string clientMAC){
if(clientMAC.length()==17){
if((clientMAC[2]==':')&&(clientMAC[5]==':')&&(clientMAC[8]==':')&&
(clientMAC[11]==':')&&(clientMAC[14]==':'))
sprintf(thisDetector->clientMAC,clientMAC.c_str());
else
return("MAC Address should be in xx:xx:xx:xx:xx:xx format");
}
else
return("MAC Address should be in xx:xx:xx:xx:xx:xx format");
return thisDetector->clientMAC;
};
string slsDetector::executeLine(int narg, char *args[], int action) {