#include <errno.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netdb.h>#include <OpenIPMI/ipmiif.h>#include <OpenIPMI/ipmi_cmdlang.h>#include <OpenIPMI/ipmi_pet.h>#include <OpenIPMI/ipmi_lanparm.h>#include <OpenIPMI/ipmi_solparm.h>#include <OpenIPMI/ipmi_fru.h>#include <OpenIPMI/ipmi_pef.h>#include <OpenIPMI/ipmi_auth.h>#include <OpenIPMI/ipmi_debug.h>#include <OpenIPMI/ipmi_mc.h>#include <OpenIPMI/internal/ipmi_locks.h>#include <OpenIPMI/internal/ipmi_malloc.h>Go to the source code of this file.
|
|
Definition at line 2720 of file cmdlang.c. Referenced by ipmi_cmdlang_init(). |
|
|
Definition at line 1261 of file cmdlang.c. Referenced by ipmi_cmdlang_handle(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2786 of file cmdlang.c. References ipmi_mem_free(), ipmi_cmdlang_cmd_s::next, and ipmi_cmdlang_cmd_s::subcmds. Referenced by ipmi_cmdlang_cleanup(). 02787 { 02788 ipmi_cmdlang_cmd_t *cmd; 02789 02790 while (cmds) { 02791 cmd = cmds; 02792 cmds = cmd->next; 02793 if (cmd->subcmds) 02794 cleanup_level(cmd->subcmds); 02795 ipmi_mem_free(cmd); 02796 } 02797 }
|
|
|
Definition at line 2649 of file cmdlang.c. References cmdlang, DEBUG_CON_FAIL_DISABLE, DEBUG_CON_FAIL_ENABLE, DEBUG_EVENTS_DISABLE, DEBUG_EVENTS_ENABLE, DEBUG_LOCKS_DISABLE, DEBUG_LOCKS_ENABLE, DEBUG_MSG_DISABLE, DEBUG_MSG_ENABLE, DEBUG_MSG_ERR_DISABLE, DEBUG_MSG_ERR_ENABLE, DEBUG_RAWMSG_DISABLE, DEBUG_RAWMSG_ENABLE, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, ipmi_cmdinfo_get_cmdlang(), ipmi_cmdlang_get_argc(), ipmi_cmdlang_get_argv(), ipmi_cmdlang_get_bool(), ipmi_cmdlang_get_curr_arg(), ipmi_cmdlang_out(), and ipmi_cmdlang_s::location. 02650 { 02651 ipmi_cmdlang_t *cmdlang = ipmi_cmdinfo_get_cmdlang(cmd_info); 02652 int curr_arg = ipmi_cmdlang_get_curr_arg(cmd_info); 02653 int argc = ipmi_cmdlang_get_argc(cmd_info); 02654 char **argv = ipmi_cmdlang_get_argv(cmd_info); 02655 char *type; 02656 int val; 02657 02658 if ((argc - curr_arg) < 2) { 02659 cmdlang->errstr = "Not enough parameters"; 02660 cmdlang->err = EINVAL; 02661 goto out_err; 02662 } 02663 02664 type = argv[curr_arg]; 02665 curr_arg++; 02666 02667 ipmi_cmdlang_get_bool(argv[curr_arg], &val, cmd_info); 02668 if (cmdlang->err) { 02669 cmdlang->errstr = "Invalid boolean setting"; 02670 cmdlang->err = EINVAL; 02671 goto out_err; 02672 } 02673 02674 if (strcmp(type, "msg") == 0) { 02675 if (val) DEBUG_MSG_ENABLE(); else DEBUG_MSG_DISABLE(); 02676 } else if (strcmp(type, "msgerr") == 0) { 02677 if (val) DEBUG_MSG_ERR_ENABLE(); else DEBUG_MSG_ERR_DISABLE(); 02678 } else if (strcmp(type, "rawmsg") == 0) { 02679 if (val) DEBUG_RAWMSG_ENABLE(); else DEBUG_RAWMSG_DISABLE(); 02680 } else if (strcmp(type, "locks") == 0) { 02681 if (val) DEBUG_LOCKS_ENABLE(); else DEBUG_LOCKS_DISABLE(); 02682 } else if (strcmp(type, "events") == 0) { 02683 if (val) DEBUG_EVENTS_ENABLE(); else DEBUG_EVENTS_DISABLE(); 02684 } else if (strcmp(type, "con0") == 0) { 02685 if (val) DEBUG_CON_FAIL_ENABLE(0); else DEBUG_CON_FAIL_DISABLE(0); 02686 } else if (strcmp(type, "con1") == 0) { 02687 if (val) DEBUG_CON_FAIL_ENABLE(1); else DEBUG_CON_FAIL_DISABLE(1); 02688 } else if (strcmp(type, "con2") == 0) { 02689 if (val) DEBUG_CON_FAIL_ENABLE(2); else DEBUG_CON_FAIL_DISABLE(2); 02690 } else if (strcmp(type, "con3") == 0) { 02691 if (val) DEBUG_CON_FAIL_ENABLE(3); else DEBUG_CON_FAIL_DISABLE(3); 02692 } else { 02693 cmdlang->errstr = "Invalid debug setting"; 02694 cmdlang->err = EINVAL; 02695 goto out_err; 02696 } 02697 02698 ipmi_cmdlang_out(cmd_info, "Debugging set", NULL); 02699 return; 02700 02701 out_err: 02702 if (cmdlang->err) 02703 cmdlang->location = "cmdlang.c(debug)"; 02704 }
|
|
|
|
Definition at line 2449 of file cmdlang.c. References ipmi_cmdlang_event_s::curr_level, ipmi_cmdlang_s::err, and ipmi_cmdlang_s::user_data. Referenced by ipmi_cmdlang_alloc_event_info(). 02450 { 02451 ipmi_cmdlang_event_t *event = cmdlang->user_data; 02452 02453 if (cmdlang->err) 02454 return; 02455 02456 event->curr_level++; 02457 }
|
|
||||||||||||||||
|
Definition at line 2279 of file cmdlang.c. References ipmi_cmdlang_event_s::curr_level, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, ipmi_cmdlang_event_s::head, IPMI_CMDLANG_STRING, ipmi_mem_alloc(), ipmi_mem_free(), ipmi_strdup(), ipmi_cmdlang_s::location, ipmi_cmdlang_event_entry_s::next, ipmi_cmdlang_event_s::tail, and ipmi_cmdlang_s::user_data. Referenced by ipmi_cmdlang_alloc_event_info(). 02280 { 02281 ipmi_cmdlang_event_entry_t *entry; 02282 ipmi_cmdlang_event_t *event = cmdlang->user_data; 02283 02284 if (cmdlang->err) 02285 return; 02286 02287 entry = ipmi_mem_alloc(sizeof(*entry)); 02288 if (!entry) 02289 goto out_nomem; 02290 02291 entry->name = ipmi_strdup(name); 02292 if (!entry->name) { 02293 ipmi_mem_free(entry); 02294 goto out_nomem; 02295 } 02296 02297 entry->type = IPMI_CMDLANG_STRING; 02298 02299 if (value) { 02300 entry->len = strlen(value); 02301 entry->value = ipmi_strdup(value); 02302 if (!entry->value) { 02303 ipmi_mem_free(entry->name); 02304 ipmi_mem_free(entry); 02305 goto out_nomem; 02306 } 02307 } else { 02308 entry->len = 0; 02309 entry->value = NULL; 02310 } 02311 02312 entry->level = event->curr_level; 02313 02314 entry->next = NULL; 02315 if (event->head) { 02316 event->tail->next = entry; 02317 event->tail = entry; 02318 } else { 02319 event->head = entry; 02320 event->tail = entry; 02321 } 02322 02323 return; 02324 02325 out_nomem: 02326 cmdlang->err = ENOMEM; 02327 cmdlang->errstr = "Out of memory"; 02328 cmdlang->location = "cmdlang.c(event_out)"; 02329 }
|
|
||||||||||||||||||||
|
Definition at line 2332 of file cmdlang.c. References ipmi_cmdlang_event_s::curr_level, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, ipmi_cmdlang_event_s::head, IPMI_CMDLANG_BINARY, ipmi_mem_alloc(), ipmi_mem_free(), ipmi_strdup(), ipmi_cmdlang_s::location, ipmi_cmdlang_event_entry_s::next, ipmi_cmdlang_event_s::tail, and ipmi_cmdlang_s::user_data. Referenced by ipmi_cmdlang_alloc_event_info(). 02334 { 02335 ipmi_cmdlang_event_entry_t *entry; 02336 ipmi_cmdlang_event_t *event = cmdlang->user_data; 02337 02338 if (cmdlang->err) 02339 return; 02340 02341 entry = ipmi_mem_alloc(sizeof(*entry)); 02342 if (!entry) 02343 goto out_nomem; 02344 02345 entry->name = ipmi_strdup(name); 02346 if (!entry->name) { 02347 ipmi_mem_free(entry); 02348 goto out_nomem; 02349 } 02350 02351 entry->type = IPMI_CMDLANG_BINARY; 02352 02353 entry->len = len; 02354 if (len > 0) { 02355 entry->value = ipmi_mem_alloc(len); 02356 if (!entry->value) { 02357 ipmi_mem_free(entry->name); 02358 ipmi_mem_free(entry); 02359 goto out_nomem; 02360 } 02361 memcpy(entry->value, value, len); 02362 } else 02363 entry->value = NULL; 02364 02365 entry->level = event->curr_level; 02366 02367 entry->next = NULL; 02368 if (event->head) { 02369 event->tail->next = entry; 02370 event->tail = entry; 02371 } else { 02372 event->head = entry; 02373 event->tail = entry; 02374 } 02375 02376 return; 02377 02378 out_nomem: 02379 cmdlang->err = ENOMEM; 02380 cmdlang->errstr = "Out of memory"; 02381 cmdlang->location = "cmdlang.c(event_out_binary)"; 02382 }
|
|
||||||||||||||||||||
|
Definition at line 2385 of file cmdlang.c. References ipmi_cmdlang_event_s::curr_level, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, ipmi_cmdlang_event_s::head, IPMI_CMDLANG_UNICODE, ipmi_mem_alloc(), ipmi_mem_free(), ipmi_strdup(), ipmi_cmdlang_s::location, ipmi_cmdlang_event_entry_s::next, ipmi_cmdlang_event_s::tail, and ipmi_cmdlang_s::user_data. Referenced by ipmi_cmdlang_alloc_event_info(). 02387 { 02388 ipmi_cmdlang_event_entry_t *entry; 02389 ipmi_cmdlang_event_t *event = cmdlang->user_data; 02390 02391 if (cmdlang->err) 02392 return; 02393 02394 entry = ipmi_mem_alloc(sizeof(*entry)); 02395 if (!entry) 02396 goto out_nomem; 02397 02398 entry->name = ipmi_strdup(name); 02399 if (!entry->name) { 02400 ipmi_mem_free(entry); 02401 goto out_nomem; 02402 } 02403 02404 entry->type = IPMI_CMDLANG_UNICODE; 02405 02406 entry->len = len; 02407 if (len > 0) { 02408 entry->value = ipmi_mem_alloc(len); 02409 if (!entry->value) { 02410 ipmi_mem_free(entry->name); 02411 ipmi_mem_free(entry); 02412 goto out_nomem; 02413 } 02414 memcpy(entry->value, value, len); 02415 } else 02416 entry->value = NULL; 02417 02418 entry->level = event->curr_level; 02419 02420 entry->next = NULL; 02421 if (event->head) { 02422 event->tail->next = entry; 02423 event->tail = entry; 02424 } else { 02425 event->head = entry; 02426 event->tail = entry; 02427 } 02428 02429 return; 02430 02431 out_nomem: 02432 cmdlang->err = ENOMEM; 02433 cmdlang->errstr = "Out of memory"; 02434 cmdlang->location = "cmdlang.c(event_out_binary)"; 02435 }
|
|
|
Definition at line 2438 of file cmdlang.c. References ipmi_cmdlang_event_s::curr_level, ipmi_cmdlang_s::err, and ipmi_cmdlang_s::user_data. Referenced by ipmi_cmdlang_alloc_event_info(). 02439 { 02440 ipmi_cmdlang_event_t *event = cmdlang->user_data; 02441 02442 if (cmdlang->err) 02443 return; 02444 02445 event->curr_level--; 02446 }
|
|
|
Definition at line 2619 of file cmdlang.c. References cmdlang, do_evinfo, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, ipmi_cmdinfo_get_cmdlang(), ipmi_cmdlang_get_argc(), ipmi_cmdlang_get_argv(), ipmi_cmdlang_get_bool(), ipmi_cmdlang_get_curr_arg(), ipmi_cmdlang_out(), ipmi_cmdlang_set_evinfo(), and ipmi_cmdlang_s::location. 02620 { 02621 ipmi_cmdlang_t *cmdlang = ipmi_cmdinfo_get_cmdlang(cmd_info); 02622 int curr_arg = ipmi_cmdlang_get_curr_arg(cmd_info); 02623 int argc = ipmi_cmdlang_get_argc(cmd_info); 02624 char **argv = ipmi_cmdlang_get_argv(cmd_info); 02625 int do_evinfo; 02626 02627 if ((argc - curr_arg) < 1) { 02628 cmdlang->errstr = "True or False not entered"; 02629 cmdlang->err = EINVAL; 02630 goto out_err; 02631 } 02632 02633 ipmi_cmdlang_get_bool(argv[curr_arg], &do_evinfo, cmd_info); 02634 if (cmdlang->err) { 02635 cmdlang->errstr = "True or False not entered"; 02636 cmdlang->err = EINVAL; 02637 goto out_err; 02638 } 02639 02640 ipmi_cmdlang_set_evinfo(do_evinfo); 02641 ipmi_cmdlang_out(cmd_info, "event info set", NULL); 02642 return; 02643 02644 out_err: 02645 cmdlang->location = "cmdlang.c(evinfo)"; 02646 }
|
|
||||||||||||
|
Definition at line 1130 of file cmdlang.c. References for_each_conn_handler(), and ipmi_domain_iterate_connections(). Referenced by for_each_connection(). 01131 { 01132 ipmi_domain_iterate_connections(domain, for_each_conn_handler, cb_data); 01133 }
|
|
||||||||||||||||
|
Definition at line 1121 of file cmdlang.c. References conn_iter_info_s::cb_data, conn_iter_info_s::conn, and conn_iter_info_s::handler. Referenced by for_each_conn_domain_handler(). 01122 { 01123 conn_iter_info_t *info = cb_data; 01124 01125 if ((info->conn == -1) || (info->conn == conn)) 01126 info->handler(domain, conn, info->cb_data); 01127 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 1136 of file cmdlang.c. References conn_iter_info_s::cb_data, conn_iter_info_s::cmd_info, ipmi_cmd_info_s::cmdlang, conn_iter_info_s::conn, ipmi_cmdlang_s::err, ipmi_cmdlang_s::errstr, for_each_conn_domain_handler(), for_each_domain(), conn_iter_info_s::handler, and ipmi_cmdlang_s::location. Referenced by ipmi_cmdlang_connection_handler(). 01142 { 01143 conn_iter_info_t info; 01144 char *endptr; 01145 01146 if (class) { 01147 cmd_info->cmdlang->errstr = "Invalid connection"; 01148 cmd_info->cmdlang->err = EINVAL; 01149 cmd_info->cmdlang->location = "cmdlang.c(for_each_connection)"; 01150 return; 01151 } 01152 01153 if (obj) { 01154 if (!isdigit(obj[0])) { 01155 cmd_info->cmdlang->errstr = "Invalid connection number"; 01156 cmd_info->cmdlang->err = EINVAL; 01157 cmd_info->cmdlang->location = "cmdlang.c(for_each_connection)"; 01158 return; 01159 } 01160 info.conn = strtoul(obj, &endptr, 0); 01161 if (*endptr != '\0') { 01162 cmd_info->cmdlang->errstr = "Invalid connection number"; 01163 cmd_info->cmdlang->err = EINVAL; 01164 cmd_info->cmdlang->location = "cmdlang.c(for_each_connection)"; 01165 return; 01166 } 01167 } else { 01168 info.conn = -1; 01169 } 01170 info.handler = handler; 01171 info.cb_data = cb_data; 01172 info.cmd_info = cmd_info; 01173 for_each_domain(cmd_info, domain, NULL, NULL, 01174 for_each_conn_domain_handler, &info); 01175 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 969 of file cmdlang.c. References control_iter_info_s::cb_data, control_iter_info_s::cmd_info, control_iter_info_s::cmpstr, for_each_control_entity_handler(), for_each_entity(), and control_iter_info_s::handler. Referenced by ipmi_cmdlang_control_handler(). 00975 { 00976 control_iter_info_t info; 00977 00978 info.cmpstr = obj; 00979 info.handler = handler; 00980 info.cb_data = cb_data; 00981 info.cmd_info = cmd_info; 00982 for_each_entity(cmd_info, domain, class, NULL, 00983 for_each_control_entity_handler, &info); 00984 }
|
|