From 77d21d16f94cbcb9f6f5b9b4b3944057d2fac9f5 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 6 Jan 2012 10:11:56 +0000 Subject: [PATCH] added the set & get functions for clientIP and clientMAC git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@76 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/slsDetector/slsDetector.cpp | 17 +++++++++++++++-- slsDetectorSoftware/slsDetector/slsDetector.h | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index ee0fc306d..ed3c93698 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -357,9 +357,9 @@ int slsDetector::initializeDetectorSize(detectorType type) { strcpy(thisDetector->hostname,DEFAULT_HOSTNAME); /** set client ip address */ - strcpy(thisDetector->clientIPAddress,"none"); + strcpy(thisDetector->clientIP,"none"); /** set client mac address */ - strcpy(thisDetector->clientMacAddress,"none"); + strcpy(thisDetector->clientMAC,"none"); /** sets onlineFlag to OFFLINE_FLAG */ thisDetector->onlineFlag=OFFLINE_FLAG; @@ -5460,6 +5460,18 @@ string slsDetector::executeLine(int narg, char *args[], int action) { sprintf(answer,form,answer,oen[ie]); } return string(answer); + }else if (var=="clientip") { + if (action==PUT_ACTION) { + sval=string(args[1]); + return string(setClientIP(sval)); + } else + return getClientIP(); + } else if (var=="clientmac") { + if (action==PUT_ACTION) { + sval=string(args[1]); + return string(setClientMAC(sval)); + } else + return getClientMAC(); } @@ -5473,6 +5485,7 @@ string slsDetector::executeLine(int narg, char *args[], int action) { + if (setOnline()) setTCPSocket(); diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 8502b5cc1..7b1ec3f6e 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -312,9 +312,9 @@ typedef struct sharedSlsDetector { /*extra gotthard members*/ /** is the ip address of the client for gotthard; read from configuration file **/ - char clientIPAddress[MAX_STR_LENGTH]; + char clientIP[MAX_STR_LENGTH]; /** is the mac address of the client for gotthard; read from configuration file **/ - char clientMacAddress[MAX_STR_LENGTH]; + char clientMAC[MAX_STR_LENGTH]; } sharedSlsDetector; @@ -442,6 +442,16 @@ typedef struct sharedSlsDetector { int disconnectStop(); + /** returns the client IP address for gotthard \sa sharedSlsDetector */ + char* getClientIP() {return thisDetector->clientIP;}; + /** returns the client MAC address for gotthard \sa sharedSlsDetector */ + char* getClientMAC() {return thisDetector->clientMAC;}; + /** sets the client IP address for gotthard \sa sharedSlsDetector */ + char* setClientIP(string clientIP) {sprintf(thisDetector->clientIP,clientIP.c_str()); return thisDetector->clientIP;}; + /** sets the client MAC address for gotthard \sa sharedSlsDetector */ + char* setClientMAC(string clientMAC) {sprintf(thisDetector->clientMAC,clientMAC.c_str());return thisDetector->clientMAC;}; + + /* I/O */ /** returns the detector trimbit/settings directory \sa sharedSlsDetector */ char* getSettingsDir() {return thisDetector->settingsDir;};