summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/ogAdmServer.cpp25
-rw-r--r--sources/ogAdmServer.h2
2 files changed, 17 insertions, 10 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp
index 92d6f89..41400d6 100644
--- a/sources/ogAdmServer.cpp
+++ b/sources/ogAdmServer.cpp
@@ -1404,14 +1404,19 @@ bool respuestaConsola(int socket_c, TRAMA *ptrTrama, int res)
// ________________________________________________________________________________________________________
static bool Arrancar(TRAMA* ptrTrama, struct og_client *cli)
{
+ char *ptrIP[MAXIMOS_CLIENTES],*ptrMacs[MAXIMOS_CLIENTES];
char *iph,*mac,*mar;
bool res;
+ int lon;
iph = copiaParametro("iph",ptrTrama); // Toma dirección/es IP
mac = copiaParametro("mac",ptrTrama); // Toma dirección/es MAC
mar = copiaParametro("mar",ptrTrama); // Método de arranque (Broadcast o Unicast)
- res=Levanta(iph,mac,mar);
+ lon = splitCadena(ptrIP, iph, ';');
+ lon = splitCadena(ptrMacs, mac, ';');
+
+ res = Levanta(ptrIP, ptrMacs, lon, mar);
liberaMemoria(iph);
liberaMemoria(mac);
@@ -1442,12 +1447,12 @@ static bool Arrancar(TRAMA* ptrTrama, struct og_client *cli)
// true: Si el proceso es correcto
// false: En caso de ocurrir algún error
// ________________________________________________________________________________________________________
-bool Levanta(char *iph, char *mac, char *mar)
+
+bool Levanta(char *ptrIP[], char *ptrMacs[], int lon, char *mar)
{
- char *ptrIP[MAXIMOS_CLIENTES],*ptrMacs[MAXIMOS_CLIENTES];
unsigned int on = 1;
sockaddr_in local;
- int i, lon, res;
+ int i, res;
int s;
/* Creación de socket para envío de magig packet */
@@ -1467,8 +1472,6 @@ bool Levanta(char *iph, char *mac, char *mar)
local.sin_port = htons(PUERTO_WAKEUP);
local.sin_addr.s_addr = htonl(INADDR_ANY);
- lon = splitCadena(ptrIP, iph, ';');
- lon = splitCadena(ptrMacs, mac, ';');
for (i = 0; i < lon; i++) {
if (!WakeUp(s, ptrIP[i], ptrMacs[i], mar)) {
syslog(LOG_ERR, "problem sending magic packet\n");
@@ -3329,11 +3332,12 @@ static bool recibeArchivo(TRAMA *ptrTrama, struct og_client *cli)
// ________________________________________________________________________________________________________
static bool envioProgramacion(TRAMA *ptrTrama, struct og_client *cli)
{
+ char *ptrIP[MAXIMOS_CLIENTES],*ptrMacs[MAXIMOS_CLIENTES];
char sqlstr[LONSQL], msglog[LONSTD];
char *idp,iph[LONIP],mac[LONMAC];
Database db;
Table tbl;
- int idx,idcomando;
+ int idx,idcomando,lon;
if (!db.Open(usuario, pasguor, datasource, catalog)) {
db.GetErrorErrStr(msglog);
@@ -3387,11 +3391,14 @@ static bool envioProgramacion(TRAMA *ptrTrama, struct og_client *cli)
return false;
}
+ lon = splitCadena(ptrIP, iph, ';');
+ lon = splitCadena(ptrMacs, mac, ';');
+
// Se manda por broadcast y por unicast
- if (!Levanta(iph, mac, (char*)"1"))
+ if (!Levanta(ptrIP, ptrMacs, lon, (char*)"1"))
return false;
- if (!Levanta(iph, mac, (char*)"2"))
+ if (!Levanta(ptrIP, ptrMacs, lon, (char*)"2"))
return false;
}
diff --git a/sources/ogAdmServer.h b/sources/ogAdmServer.h
index 1812d83..22ffd30 100644
--- a/sources/ogAdmServer.h
+++ b/sources/ogAdmServer.h
@@ -46,7 +46,7 @@ bool recorreProcedimientos(Database ,char* ,FILE*,char*);
bool buscaComandos(char *,TRAMA *,int *);
bool respuestaConsola(int socket, TRAMA *,int);
bool enviaComando(TRAMA *ptrTrama,const char*);
-bool Levanta(char*,char*,char*);
+bool Levanta(char**, char**, int, char*);
bool WakeUp(int,char*,char*,char*);
void PasaHexBin(char *,char *);
bool actualizaCreacionImagen(Database,Table,char*,char*,char*,char*,char*,char*);