Code

Updated daemon
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 10:55:29 +0000 (10:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 10:55:29 +0000 (10:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9669 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_gosaSupportDaemon.inc

index be7c854a5f508ced2380f143849ca0f58a327bc4..4511c35e0d92f3cfcad1f96aadee5129ddd97f35 100644 (file)
@@ -235,6 +235,53 @@ $xml_msg.= "
   }
 
 
+  /*! \brief  Returns an entry containing all requested ids.
+    @param  Array   The IDs of the entries we want to return.
+    @return Array   Of the requested entries. 
+   */
+  public function get_entries_by_mac($macs)
+  {
+    if(!is_array($macs)){
+      trigger_error("Requires an array as parameter.");
+      return;
+    }
+    $this->reset_error();
+
+    $ret = array();
+
+    $xml_msg = "<xml>
+      <header>gosa_query_jobdb</header>
+      <target>GOSA</target>
+      <source>GOSA</source>
+      <where>
+      <clause>
+      <connector>or</connector>";
+    foreach($macs as $mac){
+      $xml_msg .= "<phrase>
+        <operator>eq</operator>
+        <macaddress>".$mac."</macaddress>
+        </phrase>";
+    }
+    $xml_msg .= "</clause>
+      </where>
+      </xml>";
+
+    if($this->connect()){
+      $this->o_sock->write($xml_msg);
+      $str = trim($this->o_sock->read());
+      $entries = $this->xml_to_array($str); 
+      if(isset($entries['XML'])){
+        foreach($entries['XML'] as $name => $entry){
+          if(preg_match("/^ANSWER[0-9]*$/",$name)){
+            $ret[$name] = $entry;
+          }
+        }
+      }
+    }
+    return($ret);
+  }
+
+
   /*! \brief  Returns an entry containing all requested ids.
     @param  Array   The IDs of the entries we want to return.
     @return Array   Of the requested entries.