Explorar o código

Merged in FD3-699 (pull request #3)

FD3-699 se agrega id y type en hook de mysql
Guillermo Espinoza %!s(int64=6) %!d(string=hai) anos
pai
achega
7c1923ca27
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      hooks/mysql/src/callouts.cc

+ 8 - 1
hooks/mysql/src/callouts.cc

@@ -3,6 +3,7 @@
 #include <dhcp/hwaddr.h>
 #include <dhcpsrv/subnet.h>
 #include <dhcpsrv/lease.h>
+#include <dhcpsrv/host.h>
 #include <util/strutil.h>
 #include <dhcp/option_string.h>
 #include <dhcp/option4_addrlst.h>
@@ -150,7 +151,6 @@ int pkt4_receive(CalloutHandle& handle)
     }
 
     std::string me, me2;
-
     BOOST_FOREACH(me, list_class) {
          LOG_INFO(runscript_logger, FLOWDAT_DEBUG_STRING).arg("class  : " + me);
 
@@ -162,6 +162,13 @@ int pkt4_receive(CalloutHandle& handle)
          }
 
          query->addClass(me);
+         
+         Host::IdentifierType type;
+         std::vector<uint8_t> id((me + "-" + mac).begin(), (me + "-" + mac).end());
+         type = Host::IDENT_FLEX;
+         
+         handle.setArgument("id_value", id);
+         handle.setArgument("id_type", type);
     }
 
     return 0;