1 | // ******************************************************************************************************** |
---|
2 | // Cliernte: ogAdmLnxClient |
---|
3 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
4 | // Fecha Creación: Febrero-2012 |
---|
5 | // Fecha Última modificación: Febrero-2012 |
---|
6 | // Nombre del fichero: ogAdmLnxClient.c |
---|
7 | // Descripción :Este fichero implementa el cliente windows del sistema |
---|
8 | // ******************************************************************************************************** |
---|
9 | #include "ogAdmLnxClient.h" |
---|
10 | #include "ogAdmLib.c" |
---|
11 | |
---|
12 | // ________________________________________________________________________________________________________ |
---|
13 | // Función: EjecutarScript |
---|
14 | // |
---|
15 | // Descripción: |
---|
16 | // Ejecuta código de script |
---|
17 | // Parámetros: |
---|
18 | // ptrTrama: contenido del mensaje |
---|
19 | // Devuelve: |
---|
20 | // TRUE: Si el proceso es correcto |
---|
21 | // FALSE: En caso de ocurrir algún error |
---|
22 | //______________________________________________________________________________________________________ |
---|
23 | BOOLEAN EjecutarScript(TRAMA* ptrTrama) |
---|
24 | { |
---|
25 | int lon,resul,res; |
---|
26 | char *nfn,*ids,*cod,*scp,msglog[LONSTD]; |
---|
27 | char modulo[] = "EjecutarScript()"; |
---|
28 | |
---|
29 | |
---|
30 | if (ndebug>=DEBUG_MAXIMO) { |
---|
31 | sprintf(msglog, "%s:%s",tbMensajes[21],modulo); |
---|
32 | infoDebug(msglog); |
---|
33 | } |
---|
34 | |
---|
35 | nfn=copiaParametro("nfn",ptrTrama); |
---|
36 | ids=copiaParametro("ids",ptrTrama); |
---|
37 | |
---|
38 | scp=copiaParametro("scp",ptrTrama); |
---|
39 | cod=URLDecode(scp); |
---|
40 | |
---|
41 | res=0; |
---|
42 | /* Nombre del archivo de script */ |
---|
43 | char filescript[LONPRM]; |
---|
44 | sprintf(filescript,"/tmp/_script_%s",IPlocal); |
---|
45 | if(!escribeArchivo(filescript,cod)){ |
---|
46 | errorLog(modulo, 52, FALSE); |
---|
47 | res=52; // Error al crear fichero de comandos |
---|
48 | } |
---|
49 | |
---|
50 | if(res==0){ |
---|
51 | sprintf(filescript,"chmod 0777 /tmp/_script_%s",IPlocal); |
---|
52 | |
---|
53 | resul=system(filescript); |
---|
54 | if (resul==0) { |
---|
55 | sprintf(filescript,"/tmp/_script_%s",IPlocal); |
---|
56 | resul=system(filescript); |
---|
57 | if (resul>0) { |
---|
58 | errorLog(modulo, 86, FALSE); |
---|
59 | } |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | initParametros(ptrTrama,0); |
---|
64 | lon=sprintf(ptrTrama->parametros,"nfn=%s\r","RESPUESTA_EjecutarScript"); |
---|
65 | respuestaEjecucionComando(ptrTrama,resul,ids); |
---|
66 | return(TRUE); |
---|
67 | } |
---|
68 | //________________________________________________________________________________________________________ |
---|
69 | // Función: tomaConfiguracion |
---|
70 | // |
---|
71 | // Descripción: |
---|
72 | // Lee el fichero de configuración del servicio |
---|
73 | // Parámetros: |
---|
74 | // filecfg : Ruta completa al fichero de configuración |
---|
75 | // Devuelve: |
---|
76 | // TRUE: Si el proceso es correcto |
---|
77 | // FALSE: En caso de ocurrir algún error |
---|
78 | //________________________________________________________________________________________________________ |
---|
79 | BOOLEAN tomaConfiguracion(char* filecfg) |
---|
80 | { |
---|
81 | char modulo[] = "tomaConfiguracion()"; |
---|
82 | |
---|
83 | if (filecfg == NULL || strlen(filecfg) == 0) { |
---|
84 | errorLog(modulo, 1, FALSE); // Fichero de configuración del cliente vacío |
---|
85 | return (FALSE); |
---|
86 | } |
---|
87 | FILE *fcfg; |
---|
88 | int lSize; |
---|
89 | char * buffer, *lineas[MAXPRM], *dualparametro[2]; |
---|
90 | int i, numlin, resul; |
---|
91 | |
---|
92 | fcfg = fopen(filecfg, "rt"); |
---|
93 | if (fcfg == NULL) { |
---|
94 | errorLog(modulo, 2, FALSE); // No existe fichero de configuración del cliente |
---|
95 | return (FALSE); |
---|
96 | } |
---|
97 | |
---|
98 | fseek(fcfg, 0, SEEK_END); |
---|
99 | lSize = ftell(fcfg); // Obtiene tamaño del fichero. |
---|
100 | rewind(fcfg); |
---|
101 | buffer = (char*) reservaMemoria(lSize+1); // Toma memoria para el buffer de lectura. |
---|
102 | if (buffer == NULL) { // No hay memoria suficiente para el buffer |
---|
103 | errorLog(modulo, 3, FALSE); |
---|
104 | return (FALSE); |
---|
105 | } |
---|
106 | lSize=fread(buffer, 1, lSize, fcfg); // Lee contenido del fichero |
---|
107 | buffer[lSize]=CHARNULL; |
---|
108 | fclose(fcfg); |
---|
109 | |
---|
110 | /* Inicializar variables globales */ |
---|
111 | servidoradm[0]=CHARNULL; |
---|
112 | puerto[0] = CHARNULL; |
---|
113 | IPlocal[0]=CHARNULL; |
---|
114 | |
---|
115 | numlin = splitCadena(lineas, buffer, '\n'); |
---|
116 | for (i = 0; i < numlin; i++){ |
---|
117 | splitCadena(dualparametro, lineas[i], '='); |
---|
118 | |
---|
119 | resul = strcmp(StrToUpper(dualparametro[0]), "SERVIDORADM"); |
---|
120 | if (resul == 0) |
---|
121 | strcpy(servidoradm, dualparametro[1]); |
---|
122 | |
---|
123 | resul = strcmp(StrToUpper(dualparametro[0]), "PUERTO"); |
---|
124 | if (resul == 0) |
---|
125 | strcpy(puerto, dualparametro[1]); |
---|
126 | |
---|
127 | resul = strcmp(StrToUpper(dualparametro[0]), "IPLOCAL"); |
---|
128 | if (resul == 0) |
---|
129 | strcpy(IPlocal, dualparametro[1]); |
---|
130 | } |
---|
131 | |
---|
132 | if (servidoradm[0] == CHARNULL) { |
---|
133 | errorLog(modulo,4, FALSE); // Falta parámetro SERVIDORADM |
---|
134 | return (FALSE); |
---|
135 | } |
---|
136 | |
---|
137 | if (puerto[0] == CHARNULL) { |
---|
138 | errorLog(modulo,5, FALSE); // Falta parámetro PUERTO |
---|
139 | return (FALSE); |
---|
140 | } |
---|
141 | if (IPlocal[0] == CHARNULL) { |
---|
142 | errorLog(modulo, 92, FALSE); // Falta parámetro IPLOCAL |
---|
143 | return (FALSE); |
---|
144 | } |
---|
145 | return (TRUE); |
---|
146 | } |
---|
147 | //______________________________________________________________________________________________________ |
---|
148 | // Función: InclusionClienteWinLnx |
---|
149 | // Descripción: |
---|
150 | // Abre una sesión en el servidor de administración y registra al cliente en el sistema |
---|
151 | // Parámetros: |
---|
152 | // Ninguno |
---|
153 | // Devuelve: |
---|
154 | // TRUE: Si el proceso es correcto |
---|
155 | // FALSE: En caso de ocurrir algún error |
---|
156 | //______________________________________________________________________________________________________ |
---|
157 | BOOLEAN InclusionClienteWinLnx(TRAMA* ptrTrama) |
---|
158 | { |
---|
159 | int lon; |
---|
160 | SOCKET socket_c; |
---|
161 | char modulo[] = "InclusionClienteWinLnx()"; |
---|
162 | |
---|
163 | initParametros(ptrTrama,0); |
---|
164 | lon=sprintf(ptrTrama->parametros,"nfn=InclusionClienteWinLnx\r"); // Nombre de la función a ejecutar en el servidor |
---|
165 | |
---|
166 | if(!enviaMensajeServidor(&socket_c,ptrTrama,MSG_PETICION)){ |
---|
167 | errorLog(modulo,37,FALSE); |
---|
168 | return(FALSE); |
---|
169 | } |
---|
170 | ptrTrama=recibeMensaje(&socket_c); |
---|
171 | if(!ptrTrama){ |
---|
172 | errorLog(modulo,22,FALSE); |
---|
173 | return(FALSE); |
---|
174 | } |
---|
175 | close(socket_c); |
---|
176 | |
---|
177 | if(!gestionaTrama(ptrTrama)){ // Análisis de la trama |
---|
178 | errorLog(modulo,39,FALSE); |
---|
179 | return(FALSE); |
---|
180 | } |
---|
181 | |
---|
182 | return(TRUE); |
---|
183 | } |
---|
184 | //______________________________________________________________________________________________________ |
---|
185 | // Función: RESPUESTA_InclusionClienteWinLnx |
---|
186 | // |
---|
187 | // Descripción: |
---|
188 | // Respuesta del servidor de administración a la petición de inicio |
---|
189 | // enviando los datos identificativos del cliente |
---|
190 | // Parámetros: |
---|
191 | // - ptrTrama: Trama recibida por el servidor con el contenido y los parámetros |
---|
192 | // Devuelve: |
---|
193 | // TRUE: Si el proceso es correcto |
---|
194 | // FALSE: En caso de ocurrir algún error |
---|
195 | //______________________________________________________________________________________________________ |
---|
196 | BOOLEAN RESPUESTA_InclusionClienteWinLnx(TRAMA* ptrTrama) |
---|
197 | { |
---|
198 | char* res; |
---|
199 | char modulo[] = "RESPUESTA_InclusionClienteWinLnx()"; |
---|
200 | int err; |
---|
201 | |
---|
202 | res=copiaParametro("res",ptrTrama); // Resultado del proceso de inclusión |
---|
203 | err=(int)atoi(res); // Código de error devuelto por el servidor |
---|
204 | if(err>0){ // Error en el proceso de inclusión |
---|
205 | errorLog(modulo,41,FALSE); |
---|
206 | errorLog(modulo,err,FALSE); |
---|
207 | return (FALSE); |
---|
208 | } |
---|
209 | strcpy(idordenador,copiaParametro("ido",ptrTrama)); // Identificador del ordenador |
---|
210 | strcpy(nombreordenador,copiaParametro("npc",ptrTrama)); // Nombre del ordenador |
---|
211 | |
---|
212 | if(idordenador==NULL || nombreordenador==NULL){ |
---|
213 | errorLog(modulo,40,FALSE); |
---|
214 | return (FALSE); |
---|
215 | } |
---|
216 | return(TRUE); |
---|
217 | } |
---|
218 | //______________________________________________________________________________________________________ |
---|
219 | // Función: ProcesaComandos |
---|
220 | // |
---|
221 | // Descripción: |
---|
222 | // Espera comando desde el Servidor de Administración para ejecutarlos |
---|
223 | // Parámetros: |
---|
224 | // Ninguno |
---|
225 | // Devuelve: |
---|
226 | // TRUE: Si el proceso es correcto |
---|
227 | // FALSE: En caso de ocurrir algún error |
---|
228 | // ________________________________________________________________________________________________________ |
---|
229 | void procesaComandos(TRAMA* ptrTrama) |
---|
230 | { |
---|
231 | int lon; |
---|
232 | SOCKET socket_c; |
---|
233 | char modulo[] = "procesaComandos()"; |
---|
234 | |
---|
235 | initParametros(ptrTrama,0); |
---|
236 | while(TRUE){ |
---|
237 | lon=sprintf(ptrTrama->parametros,"nfn=DisponibilidadComandos\r"); |
---|
238 | lon+=sprintf(ptrTrama->parametros+lon,"tpc=%s\r",CLIENTE_LNX); // Activar disponibilidad |
---|
239 | if(!enviaMensajeServidor(&socket_c,ptrTrama,MSG_INFORMACION)){ |
---|
240 | errorLog(modulo,43,FALSE); |
---|
241 | return; |
---|
242 | } |
---|
243 | infoLog(19); // Disponibilidad de cliente activada |
---|
244 | ptrTrama=recibeMensaje(&socket_c); |
---|
245 | if(!ptrTrama){ |
---|
246 | errorLog(modulo,46,FALSE); |
---|
247 | return; |
---|
248 | } |
---|
249 | |
---|
250 | close(socket_c); |
---|
251 | |
---|
252 | if(!gestionaTrama(ptrTrama)){ // Análisis de la trama |
---|
253 | errorLog(modulo,39,FALSE); |
---|
254 | return; |
---|
255 | } |
---|
256 | } |
---|
257 | } |
---|
258 | //_____________________________________________________________________________________________________ |
---|
259 | // Función: Apagar |
---|
260 | // |
---|
261 | // Descripción: |
---|
262 | // Apaga el cliente |
---|
263 | // Parámetros: |
---|
264 | // ptrTrama: contenido del mensaje |
---|
265 | // Devuelve: |
---|
266 | // TRUE: Si el proceso es correcto |
---|
267 | // FALSE: En caso de ocurrir algún error |
---|
268 | //_____________________________________________________________________________________________________ |
---|
269 | BOOLEAN Apagar(TRAMA* ptrTrama) |
---|
270 | { |
---|
271 | int lon; |
---|
272 | char *ids,msglog[LONSTD]; |
---|
273 | char modulo[] = "Apagar()"; |
---|
274 | |
---|
275 | if (ndebug>=DEBUG_MAXIMO) { |
---|
276 | sprintf(msglog, "%s:%s",tbMensajes[21],modulo); |
---|
277 | infoDebug(msglog); |
---|
278 | } |
---|
279 | ids=copiaParametro("ids",ptrTrama); |
---|
280 | |
---|
281 | initParametros(ptrTrama,0); |
---|
282 | lon=sprintf(ptrTrama->parametros,"nfn=%s\r","RESPUESTA_Apagar"); |
---|
283 | respuestaEjecucionComando(ptrTrama,0,ids); |
---|
284 | |
---|
285 | system("shutdown -h now"); |
---|
286 | return(TRUE); |
---|
287 | } |
---|
288 | //_____________________________________________________________________________________________________ |
---|
289 | // Función: Reiniciar |
---|
290 | // |
---|
291 | // Descripción: |
---|
292 | // Apaga el cliente |
---|
293 | // Parámetros: |
---|
294 | // ptrTrama: contenido del mensaje |
---|
295 | // Devuelve: |
---|
296 | // TRUE: Si el proceso es correcto |
---|
297 | // FALSE: En caso de ocurrir algún errorservidoradm |
---|
298 | //_____________________________________________________________________________________________________ |
---|
299 | BOOLEAN Reiniciar(TRAMA* ptrTrama) |
---|
300 | { |
---|
301 | int lon; |
---|
302 | char *ids,msglog[LONSTD]; |
---|
303 | char modulo[] = "Reiniciar()"; |
---|
304 | |
---|
305 | if (ndebug>=DEBUG_MAXIMO) { |
---|
306 | sprintf(msglog, "%s:%s",tbMensajes[21],modulo); |
---|
307 | infoDebug(msglog); |
---|
308 | } |
---|
309 | ids=copiaParametro("ids",ptrTrama); |
---|
310 | |
---|
311 | initParametros(ptrTrama,0); |
---|
312 | lon=sprintf(ptrTrama->parametros,"nfn=%s\r","RESPUESTA_Reiniciar"); |
---|
313 | respuestaEjecucionComando(ptrTrama,0,ids); |
---|
314 | |
---|
315 | system("shutdown -r now"); |
---|
316 | |
---|
317 | return(TRUE); |
---|
318 | } |
---|
319 | //______________________________________________________________________________________________________ |
---|
320 | // Función: Sondeo |
---|
321 | // |
---|
322 | // Descripción: |
---|
323 | // Envía al servidor una confirmación de que está dentro del sistema |
---|
324 | // Parámetros: |
---|
325 | // ptrTrama: contenido del mensajede |
---|
326 | // Devuelve: |
---|
327 | // TRUE: Si el proceso es correcto |
---|
328 | // FALSE: En caso de ocurrir algún error |
---|
329 | //______________________________________________________________________________________________________ |
---|
330 | BOOLEAN Sondeo(TRAMA* ptrTrama) |
---|
331 | { |
---|
332 | return(TRUE); |
---|
333 | } |
---|
334 | //______________________________________________________________________________________________________ |
---|
335 | // Función: respuestaEjecucionComando |
---|
336 | // |
---|
337 | // Descripción: |
---|
338 | // Envia una respuesta a una ejecucion de comando al servidor de Administración |
---|
339 | // Parámetros: |
---|
340 | // - ptrTrama: contenido del mensaje |
---|
341 | // - res: Resultado de la ejecución (Código de error devuelto por el script ejecutado) |
---|
342 | // - ids: Identificador de la sesion (En caso de no haber seguimiento es NULO) |
---|
343 | // Devuelve: |
---|
344 | // TRUE: Si el proceso es correcto |
---|
345 | // FALSE: En caso de ocurrir algún error |
---|
346 | // ________________________________________________________________________________________________________ |
---|
347 | BOOLEAN respuestaEjecucionComando(TRAMA* ptrTrama,int res,char *ids) |
---|
348 | { |
---|
349 | int lon; |
---|
350 | SOCKET socket_c; |
---|
351 | char modulo[] = "respuestaEjecucionComando()"; |
---|
352 | |
---|
353 | lon=strlen(ptrTrama->parametros); |
---|
354 | if(ids){ // Existe seguimiento |
---|
355 | lon+=sprintf(ptrTrama->parametros+lon,"ids=%s\r",ids); // Añade identificador de la sesión |
---|
356 | } |
---|
357 | if (res==0){ // Resultado satisfactorio |
---|
358 | lon+=sprintf(ptrTrama->parametros+lon,"res=%s\r","1"); |
---|
359 | lon+=sprintf(ptrTrama->parametros+lon,"der=%s\r",""); |
---|
360 | } |
---|
361 | else{ // Algún error |
---|
362 | lon+=sprintf(ptrTrama->parametros+lon,"res=%s\r","2"); |
---|
363 | lon+=sprintf(ptrTrama->parametros+lon,"der=(Errno:%d)-%s\r",res,tbErrores[res]);// Descripción del error |
---|
364 | } |
---|
365 | if(!(enviaMensajeServidor(&socket_c,ptrTrama,MSG_NOTIFICACION))){ |
---|
366 | errorLog(modulo,44,FALSE); |
---|
367 | return(FALSE); |
---|
368 | } |
---|
369 | close(socket_c); |
---|
370 | return(TRUE); |
---|
371 | } |
---|
372 | // ________________________________________________________________________________________________________ |
---|
373 | // Función: gestionaTrama |
---|
374 | // |
---|
375 | // Descripción: |
---|
376 | // Procesa las tramas recibidas.servidoradm |
---|
377 | // Parametros: |
---|
378 | // ptrTrama: contenido del mensaje |
---|
379 | // Devuelve: |
---|
380 | // TRUE: Si el proceso es correcto |
---|
381 | // FALSE: En caso de ocurrir algún error |
---|
382 | // ________________________________________________________________________________________________________ |
---|
383 | BOOLEAN gestionaTrama(TRAMA *ptrTrama) |
---|
384 | { |
---|
385 | int i, res; |
---|
386 | char *nfn; |
---|
387 | char modulo[] = "gestionaTrama()"; |
---|
388 | |
---|
389 | INTROaFINCAD(ptrTrama); |
---|
390 | nfn = copiaParametro("nfn", ptrTrama); // Toma nombre de función |
---|
391 | |
---|
392 | for (i = 0; i < MAXIMAS_FUNCIONES; i++) { // Recorre funciones que procesan las tramas |
---|
393 | res = strcmp(tbfuncionesClient[i].nf, nfn); |
---|
394 | if (res == 0) { // Encontrada la función que procesa el mensaje |
---|
395 | return(tbfuncionesClient[i].fptr(ptrTrama)); // Invoca la función |
---|
396 | } |
---|
397 | } |
---|
398 | errorLog(modulo, 18, FALSE); |
---|
399 | return (FALSE); |
---|
400 | } |
---|
401 | //______________________________________________________________________________________________________ |
---|
402 | // Función: enviaMensajeServidor |
---|
403 | // |
---|
404 | // Descripción: |
---|
405 | // Envia un mensaje al servidor de Administración |
---|
406 | // Parámetros: |
---|
407 | // - socket_c: (Salida) Socket utilizado para el envío |
---|
408 | // - ptrTrama: contenido del mensaje |
---|
409 | // - tipo: Tipo de mensaje |
---|
410 | // C=Comando, N=Respuesta a un comando, P=Peticion,R=Respuesta a una petición, I=Informacion |
---|
411 | // Devuelve: |
---|
412 | // TRUE: Si el proceso es correcto |
---|
413 | // FALSE: En caso de ocurrir algún error |
---|
414 | // ________________________________________________________________________________________________________ |
---|
415 | BOOLEAN enviaMensajeServidor(SOCKET *socket_c,TRAMA *ptrTrama,char tipo) |
---|
416 | { |
---|
417 | int lon; |
---|
418 | char modulo[] = "enviaMensajeServidor()"; |
---|
419 | |
---|
420 | *socket_c=abreConexion(); |
---|
421 | if(*socket_c==INVALID_SOCKET){ |
---|
422 | errorLog(modulo,38,FALSE); // Error de conexión con el servidor |
---|
423 | return(FALSE); |
---|
424 | } |
---|
425 | ptrTrama->arroba='@'; // Cabecera de la trama |
---|
426 | strncpy(ptrTrama->identificador,"JMMLCAMDJ_MCDJ",14); // identificador de la trama |
---|
427 | ptrTrama->tipo=tipo; // Tipo de mensaje |
---|
428 | lon=strlen(ptrTrama->parametros); // Compone la trama |
---|
429 | lon+=sprintf(ptrTrama->parametros+lon,"iph=%s\r",IPlocal); // Ip del ordenador |
---|
430 | lon+=sprintf(ptrTrama->parametros+lon,"ido=%s\r",idordenador); // Identificador del ordenador |
---|
431 | lon+=sprintf(ptrTrama->parametros+lon,"npc=%s\r",nombreordenador); // Nombre del ordenador |
---|
432 | |
---|
433 | if (!mandaTrama(socket_c,ptrTrama)) { |
---|
434 | errorLog(modulo,26,FALSE); |
---|
435 | return (FALSE); |
---|
436 | } |
---|
437 | return(TRUE); |
---|
438 | } |
---|
439 | // ******************************************************************************************************** |
---|
440 | // PROGRAMA PRINCIPAL (CLIENTE) |
---|
441 | // ******************************************************************************************************** |
---|
442 | int main(int argc, char *argv[]) |
---|
443 | { |
---|
444 | TRAMA *ptrTrama; |
---|
445 | char modulo[] = "main()"; |
---|
446 | |
---|
447 | ptrTrama=(TRAMA *)reservaMemoria(sizeof(TRAMA)); |
---|
448 | if (ptrTrama == NULL) { // No hay memoria suficiente para el bufer de las tramas |
---|
449 | errorLog(modulo, 3, FALSE); |
---|
450 | exit(EXIT_FAILURE); |
---|
451 | } |
---|
452 | /*-------------------------------------------------------------------------------------------------------- |
---|
453 | Validación de parámetros de ejecución y fichero de configuración |
---|
454 | ---------------------------------------------------------------------------------------------------------*/ |
---|
455 | /*-------------------------------------------------------------------------------------------------------- |
---|
456 | Validación de parámetros de ejecución y fichero de configuración |
---|
457 | ---------------------------------------------------------------------------------------------------------*/ |
---|
458 | if (!validacionParametros(argc, argv,7)) // Valida parámetros de ejecución |
---|
459 | exit(EXIT_FAILURE); |
---|
460 | |
---|
461 | if (!tomaConfiguracion(szPathFileCfg)) // Toma parametros de configuración |
---|
462 | exit(EXIT_FAILURE); |
---|
463 | |
---|
464 | /*-------------------------------------------------------------------------------------------------------- |
---|
465 | Carga catálogo de funciones que procesan las tramas |
---|
466 | ---------------------------------------------------------------------------------------------------------*/ |
---|
467 | int cf = 0; |
---|
468 | |
---|
469 | strcpy(tbfuncionesClient[cf].nf, "RESPUESTA_InclusionClienteWinLnx"); |
---|
470 | tbfuncionesClient[cf++].fptr = &RESPUESTA_InclusionClienteWinLnx; |
---|
471 | |
---|
472 | strcpy(tbfuncionesClient[cf].nf, "Apagar"); |
---|
473 | tbfuncionesClient[cf++].fptr = &Apagar; |
---|
474 | |
---|
475 | strcpy(tbfuncionesClient[cf].nf, "Reiniciar"); |
---|
476 | tbfuncionesClient[cf++].fptr = &Reiniciar; |
---|
477 | |
---|
478 | strcpy(tbfuncionesClient[cf].nf, "Sondeo"); |
---|
479 | tbfuncionesClient[cf++].fptr = &Sondeo; |
---|
480 | |
---|
481 | strcpy(tbfuncionesClient[cf].nf, "EjecutarScript"); |
---|
482 | tbfuncionesClient[cf++].fptr = &EjecutarScript; |
---|
483 | |
---|
484 | /*-------------------------------------------------------------------------------------------------------- |
---|
485 | Inicio de sesión |
---|
486 | ---------------------------------------------------------------------------------------------------------*/ |
---|
487 | infoLog(1); // Inicio de sesión |
---|
488 | infoLog(3); // Abriendo sesión en el servidor de Administración; |
---|
489 | /*-------------------------------------------------------------------------------------------------------- |
---|
490 | Inclusión del cliente en el sistema |
---|
491 | ---------------------------------------------------------------------------------------------------------*/ |
---|
492 | if(!InclusionClienteWinLnx(ptrTrama)){ // Ha habido algún problema al abrir sesión |
---|
493 | errorLog(modulo,0,FALSE); |
---|
494 | exit(EXIT_FAILURE); |
---|
495 | } |
---|
496 | infoLog(4); // Cliente iniciado |
---|
497 | procesaComandos(ptrTrama); // Bucle para procesar comandos interactivos |
---|
498 | exit(EXIT_SUCCESS); |
---|
499 | } |
---|