mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 00:37:12 +02:00
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:
@ -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) {
|
||||
|
@ -448,8 +448,8 @@ typedef struct sharedSlsDetector {
|
||||
char* getClientMAC() {return thisDetector->clientMAC;};
|
||||
/** validates and sets the client IP address for gotthard \sa sharedSlsDetector */
|
||||
char* setClientIP(string clientIP);
|
||||
/** sets the client MAC address for gotthard \sa sharedSlsDetector */
|
||||
char* setClientMAC(string clientMAC) {sprintf(thisDetector->clientMAC,clientMAC.c_str());return thisDetector->clientMAC;};
|
||||
/** validates the format of client MAC address and sets it for gotthard \sa sharedSlsDetector */
|
||||
char* setClientMAC(string clientMAC);
|
||||
|
||||
|
||||
/* I/O */
|
||||
|
Reference in New Issue
Block a user