#include <OpenIPMI/ipmi_types.h>#include <OpenIPMI/ipmi_addr.h>#include <OpenIPMI/ipmiif.h>#include <OpenIPMI/os_handler.h>Go to the source code of this file.
|
|
Definition at line 140 of file ipmi_conn.h. Referenced by rmcpp_format_msg(), and transmit_outstanding_packet(). |
|
|
Definition at line 144 of file ipmi_conn.h. Referenced by rmcpp_format_msg(), and transmit_outstanding_packet(). |
|
|
Definition at line 136 of file ipmi_conn.h. Referenced by rmcpp_format_msg(), and transmit_outstanding_packet(). |
|
|
Definition at line 108 of file ipmi_conn.h. Referenced by handle_intel_atca(), ipmi_format_msg(), and ipmi_handle_recv(). |
|
|
Definition at line 114 of file ipmi_conn.h. Referenced by lan_args_get_val(), lan_args_set_val(), and lan_parse_args(). |
|
|
Definition at line 120 of file ipmi_conn.h. Referenced by lan_args_get_val(), lan_args_set_val(), and lan_parse_args(). |
|
|
Definition at line 367 of file ipmi_conn.h. Referenced by auth_cap_done(), auth_cap_done_p(), check_command_queue(), check_rakp_rsp(), check_session_seq_num(), connection_up(), got_rmcpp_open_session_rsp(), handle_lan15_recv(), handle_msg_send(), handle_payload(), handle_rmcpp_recv(), lan_send_addr(), lost_connection(), open_get_recv_seq(), rmcpp_find_ipmi(), and rsp_timeout_handler(). |
|
|
Definition at line 375 of file ipmi_conn.h. Referenced by ipmi_handle_snmp_trap_data(). |
|
|
Definition at line 463 of file ipmi_conn.h. |
|
|
Definition at line 469 of file ipmi_conn.h. |
|
|
Definition at line 459 of file ipmi_conn.h. |
|
|
|
|
|
Definition at line 400 of file ipmi_conn.h. |
|
|
Definition at line 398 of file ipmi_conn.h. |
|
|
Definition at line 64 of file ipmi_conn.h. |
|
|
Definition at line 82 of file ipmi_conn.h. |
|
|
Definition at line 103 of file ipmi_conn.h. |
|
|
Definition at line 57 of file ipmi_conn.h. |
|
|
Definition at line 94 of file ipmi_conn.h. |
|
|
Definition at line 48 of file ipmi_conn.h. |
|
|
Definition at line 496 of file conn.c. References ipmi_create_global_lock(), and locked_list_alloc(). Referenced by ipmi_init(), and ipmi_register_oem_conn_handler(). 00497 { 00498 int rv; 00499 00500 if (!oem_conn_handlers_lock) { 00501 rv = ipmi_create_global_lock(&oem_conn_handlers_lock); 00502 if (rv) 00503 return rv; 00504 } 00505 00506 if (!oem_conn_handlers) { 00507 oem_conn_handlers = locked_list_alloc(os_hnd); 00508 if (!oem_conn_handlers) 00509 return ENOMEM; 00510 } 00511 if (!oem_handlers) { 00512 oem_handlers = locked_list_alloc(os_hnd); 00513 if (!oem_handlers) 00514 return ENOMEM; 00515 } 00516 return 0; 00517 }
|
|
|
Definition at line 520 of file conn.c. References cleanup_oem_conn_handlers(), ipmi_destroy_lock(), and locked_list_destroy(). Referenced by ipmi_shutdown(). 00521 { 00522 if (oem_conn_handlers) { 00523 cleanup_oem_conn_handlers(); 00524 locked_list_destroy(oem_conn_handlers); 00525 oem_conn_handlers = NULL; 00526 } 00527 00528 if (oem_handlers) { 00529 locked_list_destroy(oem_handlers); 00530 oem_handlers = NULL; 00531 } 00532 00533 if (oem_conn_handlers_lock) { 00534 ipmi_destroy_lock(oem_conn_handlers_lock); 00535 oem_conn_handlers_lock = NULL; 00536 } 00537 }
|
|
|
Definition at line 1642 of file ipmi.c. References ipmi_mem_alloc(). Referenced by atca_oem_check(), force_activate(), force_ipmb_fetch(), ipmi_send_command_addr(), lan_atca_ipmb_fetch(), mxp_activate(), mxp_handle_send_rsp_err(), mxp_ipmb_fetch(), reroute_cmds(), send_activate(), send_message(), start_rakp(), and time_msgs(). 01643 { 01644 ipmi_msgi_t *rv; 01645 01646 rv = ipmi_mem_alloc(sizeof(ipmi_msgi_t)); 01647 if (!rv) 01648 return NULL; 01649 memset(rv, 0, sizeof(rv)); 01650 rv->msg.data = rv->data; 01651 return rv; 01652 }
|
|
|
Definition at line 1663 of file ipmi.c. References ipmi_mem_alloc(). 01664 { 01665 return ipmi_mem_alloc(size); 01666 }
|
|
|
Definition at line 481 of file conn.c. References ipmi_con_s::attr, destroy_attr(), locked_list_destroy(), and locked_list_iterate(). Referenced by cleanup_con(), and lan_cleanup(). 00482 { 00483 if (con->attr) { 00484 locked_list_iterate(con->attr, destroy_attr, con); 00485 locked_list_destroy(con->attr); 00486 con->attr = NULL; 00487 } 00488 }
|
|
|
Definition at line 449 of file conn.c. References ipmi_con_attr_s::data. 00450 { 00451 return attr->data; 00452 }
|
|
|
Definition at line 472 of file conn.c. References ipmi_con_s::attr, locked_list_alloc(), and ipmi_con_s::os_hnd. Referenced by ipmi_lanp_setup_con(). 00473 { 00474 con->attr = locked_list_alloc(con->os_hnd); 00475 if (!con->attr) 00476 return ENOMEM; 00477 return 0; 00478 }
|
|
|
Definition at line 455 of file conn.c. References ipmi_con_attr_s::cb_data, ipmi_con_attr_s::data, ipmi_con_attr_s::destroy, ipmi_destroy_lock(), ipmi_lock(), ipmi_mem_free(), ipmi_unlock(), ipmi_con_attr_s::lock, ipmi_con_attr_s::name, and ipmi_con_attr_s::refcount. Referenced by destroy_attr(). 00456 { 00457 ipmi_lock(attr->lock); 00458 attr->refcount--; 00459 if (attr->refcount > 0) { 00460 ipmi_unlock(attr->lock); 00461 return; 00462 } 00463 ipmi_unlock(attr->lock); 00464 if (attr->destroy) 00465 attr->destroy(attr->cb_data, attr->data); 00466 ipmi_destroy_lock(attr->lock); 00467 ipmi_mem_free(attr->name); 00468 ipmi_mem_free(attr); 00469 }
|
|
||||||||||||||||
|
Definition at line 425 of file conn.c. References ipmi_con_s::attr, con_attr_cmp_s::attr, con_attr_cmp(), ipmi_lock(), ipmi_unlock(), ipmi_con_attr_s::lock, locked_list_iterate(), con_attr_cmp_s::name, and ipmi_con_attr_s::refcount. 00428 { 00429 con_attr_cmp_t info; 00430 00431 if (!con->attr) 00432 return EINVAL; 00433 00434 /* Attributes are immutable, no lock is required. */ 00435 info.name = name; 00436 info.attr = NULL; 00437 locked_list_iterate(con->attr, con_attr_cmp, &info); 00438 if (info.attr) { 00439 ipmi_lock(info.attr->lock); 00440 info.attr->refcount++; 00441 ipmi_unlock(info.attr->lock); 00442 *attr = info.attr; 00443 return 0; 00444 } 00445 return EINVAL; 00446 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 345 of file conn.c. References con_attr_cmp_s::attr, ipmi_con_s::attr, con_attr_cmp(), init, ipmi_create_lock_os_hnd(), ipmi_destroy_lock(), ipmi_lock(), ipmi_mem_alloc(), ipmi_mem_free(), ipmi_strdup(), ipmi_unlock(), ipmi_con_attr_s::lock, os_handler_s::lock, locked_list_add_entry_nolock(), locked_list_alloc_entry(), locked_list_free_entry(), locked_list_iterate_nolock(), locked_list_lock(), locked_list_unlock(), con_attr_cmp_s::name, ipmi_con_s::os_hnd, and ipmi_con_attr_s::refcount. 00351 { 00352 ipmi_con_attr_t *val = NULL; 00353 con_attr_cmp_t info; 00354 int rv = 0; 00355 locked_list_entry_t *entry; 00356 00357 info.name = name; 00358 info.attr = NULL; 00359 locked_list_lock(con->attr); 00360 locked_list_iterate_nolock(con->attr, con_attr_cmp, &info); 00361 if (info.attr) { 00362 ipmi_lock(info.attr->lock); 00363 info.attr->refcount++; 00364 ipmi_unlock(info.attr->lock); 00365 *attr = info.attr; 00366 goto out_unlock; 00367 } 00368 00369 val = ipmi_mem_alloc(sizeof(*val)); 00370 if (!val) { 00371 rv = ENOMEM; 00372 goto out_unlock; 00373 } 00374 00375 val->name = ipmi_strdup(name); 00376 if (!val->name) { 00377 ipmi_mem_free(val); 00378 rv = ENOMEM; 00379 goto out_unlock; 00380 } 00381 00382 entry = locked_list_alloc_entry(); 00383 if (!entry) { 00384 ipmi_mem_free(val->name); 00385 ipmi_mem_free(val); 00386 rv = ENOMEM; 00387 goto out_unlock; 00388 } 00389 00390 rv = ipmi_create_lock_os_hnd(con->os_hnd, &val->lock); 00391 if (rv) { 00392 locked_list_free_entry(entry); 00393 ipmi_mem_free(val->name); 00394 ipmi_mem_free(val); 00395 goto out_unlock; 00396 } 00397 00398 val->refcount = 2; 00399 val->destroy = destroy; 00400 val->cb_data = cb_data; 00401 val->data = NULL; 00402 00403 if (init) { 00404 rv = init(con, cb_data, &val->data); 00405 if (rv) { 00406 ipmi_destroy_lock(val->lock); 00407 locked_list_free_entry(entry); 00408 ipmi_mem_free(val->name); 00409 ipmi_mem_free(val); 00410 rv = ENOMEM; 00411 goto out_unlock; 00412 } 00413 } 00414 00415 locked_list_add_entry_nolock(con->attr, val, NULL, entry); 00416 00417 *attr = val; 00418 00419 out_unlock: 00420 locked_list_unlock(con->attr); 00421 return rv; 00422 }
|
|
||||||||||||||||
|
Definition at line 263 of file conn.c. References conn_handler_call(), conn_oem_check_done(), ipmi_create_lock_os_hnd(), ipmi_lock(), ipmi_mem_alloc(), ipmi_unlock(), os_handler_s::lock, locked_list_iterate(), and ipmi_con_s::os_hnd. Referenced by session_privilege_set(). 00266 { 00267 conn_check_oem_t *check; 00268 int rv; 00269 unsigned int count = 0; 00270 00271 check = ipmi_mem_alloc(sizeof(*check)); 00272 if (!check) 00273 return ENOMEM; 00274 00275 rv = ipmi_create_lock_os_hnd(conn->os_hnd, &check->lock); 00276 if (rv) 00277 return rv; 00278 check->count = 1; 00279 check->conn = conn; 00280 check->done = done; 00281 check->cb_data = cb_data; 00282 00283 locked_list_iterate(oem_handlers, conn_handler_call, check); 00284 00285 ipmi_lock(check->lock); 00286 count = check->count; 00287 ipmi_unlock(check->lock); 00288 00289 /* Say that this function is done with the check. */ 00290 conn_oem_check_done(conn, check); 00291 00292 return 0; 00293 }
|
|
||||||||||||
|
Definition at line 208 of file conn.c. References locked_list_remove(). Referenced by ipmi_oem_atca_conn_shutdown(). 00210 { 00211 if (locked_list_remove(oem_handlers, check, cb_data)) 00212 return 0; 00213 else 00214 return EINVAL; 00215 }
|
|
|
Definition at line 1655 of file ipmi.c. References ipmi_msg::data, ipmi_msg_item_s::data, ipmi_free_msg_item_data(), ipmi_mem_free(), and ipmi_msg_item_s::msg. Referenced by atca_oem_check(), deliver_rsp(), force_activate(), force_ipmb_fetch(), handle_response(), ipmi_handle_rsp_item(), ipmi_handle_rsp_item_copyall(), ipmi_handle_rsp_item_copymsg(), ipmi_send_command_addr(), lan_atca_ipmb_fetch(), ll_rsp_handler(), ll_si_rsp_handler(), mxp_activate(), mxp_handle_send_rsp_err(), mxp_ipmb_fetch(), reroute_cmds(), rmcpp_auth_finished(), send_activate(), send_message(), start_rakp(), and time_msgs(). 01656 { 01657 if (item->msg.data && (item->msg.data != item->data)) 01658 ipmi_free_msg_item_data(item->msg.data); 01659 ipmi_mem_free(item); 01660 }
|
|
|
Definition at line 1669 of file ipmi.c. References ipmi_mem_free(). Referenced by ipmi_free_msg_item(), and ipmi_move_msg_item(). 01670 { 01671 ipmi_mem_free(data); 01672 }
|
|
||||||||||||||||
|
Definition at line 1737 of file ipmi.c. References ipmi_free_msg_item(), IPMI_MSG_ITEM_NOT_USED, and rsp_handler(). Referenced by handle_payload(), lan_cleanup(), and rsp_timeout_handler(). 01740 { 01741 int used = IPMI_MSG_ITEM_NOT_USED; 01742 01743 /* call the user handler. */ 01744 if (rsp_handler) 01745 used = rsp_handler(ipmi, rspi); 01746 01747 if (!used) 01748 ipmi_free_msg_item(rspi); 01749 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 1693 of file ipmi.c. References ipmi_msg_item_s::addr, ipmi_msg_item_s::addr_len, ipmi_msg_item_s::data, ipmi_msg::data, ipmi_msg::data_len, ipmi_free_msg_item(), IPMI_MSG_ITEM_NOT_USED, ipmi_msg_item_s::msg, and rsp_handler(). Referenced by check_command_queue(), and lan_cleanup(). 01699 { 01700 int used = IPMI_MSG_ITEM_NOT_USED; 01701 01702 memcpy(&rspi->addr, addr, addr_len); 01703 rspi->addr_len = addr_len; 01704 rspi->msg = *msg; 01705 memcpy(rspi->data, msg->data, msg->data_len); 01706 rspi->msg.data = rspi->data; 01707 01708 /* call the user handler. */ 01709 if (rsp_handler) 01710 used = rsp_handler(ipmi, rspi); 01711 01712 if (!used) 01713 ipmi_free_msg_item(rspi); 01714 }
|
|
||||||||||||||||||||
|
Definition at line 1717 of file ipmi.c. References ipmi_msg_item_s::data, ipmi_msg::data, ipmi_msg::data_len, ipmi_free_msg_item(), IPMI_MSG_ITEM_NOT_USED, ipmi_msg_item_s::msg, and rsp_handler(). 01721 { 01722 int used = IPMI_MSG_ITEM_NOT_USED; 01723 01724 rspi->msg = *msg; 01725 memcpy(rspi->data, msg->data, msg->data_len); 01726 rspi->msg.data = rspi->data; 01727 01728 /* call the user handler. */ 01729 if (rsp_handler) 01730 used = rsp_handler(ipmi, rspi); 01731 01732 if (!used) 01733 ipmi_free_msg_item(rspi); 01734 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 1527 of file ipmi.c. References ipmi_msg::cmd, ipmi_msg::data, ipmi_msg::data_len, DEBUG_RAWMSG, dump_hex(), IPMI_APP_NETFN, IPMI_EXTERN_ADDR_IP, ipmi_lan_handle_external_event(), ipmi_log(), IPMI_LOG_DEBUG_CONT, IPMI_LOG_DEBUG_END, IPMI_LOG_DEBUG_START, IPMI_READ_EVENT_MSG_BUFFER_CMD, IPMI_SNMP_DATE_OFFSET, and ipmi_msg::netfn. 01533 { 01534 int handled = 0; 01535 unsigned char pet_ack[12]; 01536 ipmi_msg_t *msg = NULL; 01537 01538 if (DEBUG_RAWMSG) { 01539 ipmi_log(IPMI_LOG_DEBUG_START, "Got SNMP trap from:\n "); 01540 dump_hex(src_addr, src_addr_len); 01541 ipmi_log(IPMI_LOG_DEBUG_CONT, "\n data is:\n "); 01542 dump_hex(data, data_len); 01543 ipmi_log(IPMI_LOG_DEBUG_END, " "); 01544 } 01545 01546 if (data_len < 46) 01547 return 0; 01548 01549 /* I will take this opportunity to note that the SNMP trap format 01550 from IPMI is insufficient to actually perform the job. It does 01551 not have: 01552 1 A guaranteed way to correlate the timestamp to the SEL. 01553 2 A guaranteed way to correlate the record id to the SEL. 01554 3 The channel or the LUN for the event generator. 01555 01556 Because of these, there is no guaranteed way to correlate the 01557 data from the SNMP trap to an SEL event. This can result in 01558 duplicate events, which is very bad. So we currently do not 01559 deliver the events this way, we pass a NULL in the event 01560 message to tell the domain code to rescan the SEL for this MC. 01561 In addition, item 3 above means that you cannot determine which 01562 sensor issued the event, since the channel and the LUN are 01563 required to find the sensor. 01564 */ 01565 01566 /* Until we have some way to get full valid data from the trap, we 01567 just disable it. */ 01568 #if 0 01569 ipmi_msg_t tmsg; 01570 unsigned char edata[17]; 01571 unsigned long timestamp; 01572 int16_t utc_off; 01573 unsigned short record_id; 01574 timestamp = ntohl(*((uint32_t *) (data+18))); 01575 if (data[27] == 0xff) 01576 /* Can't handle unspecific event generator */ 01577 return 0; 01578 if ((data[28] == 0xff) || (data[28] == 0x00)) 01579 /* Can't handle unspecific sensor */ 01580 return 0; 01581 if (timestamp == 0) 01582 /* Can't handle unspecified timestamp. */ 01583 return 0; 01584 utc_off = ntohs(*((uint16_t *) (data+22))); 01585 if (utc_off == -1) 01586 /* If unspecified (0xffff), we assume zero (UTC). */ 01587 utc_off = 0; 01588 timestamp -= utc_off; /* Remove timezone offset */ 01589 timestamp += IPMI_SNMP_DATE_OFFSET; /* Convert to 1/1/70 offset */ 01590 01591 /* We assume the record id is in the sequence # field, since that 01592 makes the most sense. */ 01593 record_id = ntohs(*((uint16_t *) (data+16))); 01594 01595 tmsg.netfn = IPMI_APP_NETFN; 01596 tmsg.cmd = IPMI_READ_EVENT_MSG_BUFFER_CMD; 01597 tmsg.data = edata; 01598 tmsg.data_len = 17; 01599 msg = &tmsg; 01600 edata[0] = 0; 01601 edata[1] = record_id & 0xff; 01602 edata[2] = (record_id >> 8) & 0xff; 01603 edata[3] = 2; /* record type - system event */ 01604 edata[4] = timestamp & 0xff; 01605 edata[5] = (timestamp >> 8) & 0xff; 01606 edata[6] = (timestamp >> 16) & 0xff; 01607 edata[7] = (timestamp >> 24) & 0xff; 01608 edata[8] = data[27]; /* Event generator */ 01609 /* FIXME - is there a way to get the LUN? */ 01610 edata[9] = 0; /* Assume channel 0, lun 0 */ 01611 edata[10] = 0x04; /* IPMI 1.5 revision */ 01612 edata[11] = (specific >> 16) & 0xff; /* Sensor type */ 01613 edata[12] = data[28]; /* Sensor number */ 01614 edata[13] = (specific >> 8) & 0xff; /* Event dir/type */ 01615 memcpy(edata+14, data+31, 3); /* Event data 1-3 */ 01616 #endif 01617 01618 pet_ack[0] = data[17]; /* Record id */ 01619 pet_ack[1] = data[16]; 01620 pet_ack[2] = data[21]; /* Timestamp */ 01621 pet_ack[3] = data[20]; 01622 pet_ack[4] = data[19]; 01623 pet_ack[5] = data[18]; 01624 pet_ack[6] = data[25]; /* Event source type */ 01625 pet_ack[7] = data[27]; /* Sensor device */ 01626 pet_ack[8] = data[28]; /* Sensor number */ 01627 memcpy(pet_ack+9, data+31, 3); /* Event data 1-3 */ 01628 01629 if (src_addr_type == IPMI_EXTERN_ADDR_IP) 01630 handled = ipmi_lan_handle_external_event(src_addr, msg, pet_ack); 01631 01632 return handled; 01633 }
|
|
||||||||||||
|
Definition at line 1675 of file ipmi.c. References ipmi_msg::data, ipmi_msg_item_s::data, ipmi_msg::data_len, ipmi_free_msg_item_data(), and ipmi_msg_item_s::msg. Referenced by ll_rsp_handler(), and ll_si_rsp_handler(). 01676 { 01677 if (new_item->msg.data && (new_item->msg.data != new_item->data)) 01678 ipmi_free_msg_item_data(new_item->msg.data); 01679 new_item->msg = old_item->msg; 01680 01681 if (!old_item->msg.data) { 01682 /* Nothing to do */ 01683 } else if (old_item->msg.data != old_item->data) { 01684 /* Copied the actual data pointer. */ 01685 old_item->msg.data = NULL; 01686 } else { 01687 memcpy(new_item->data, old_item->data, old_item->msg.data_len); 01688 new_item->msg.data = new_item->data; 01689 } 01690 }
|
|
||||||||||||
|
Definition at line 198 of file conn.c. References locked_list_add(). Referenced by ipmi_oem_atca_conn_init(). 00200 { 00201 if (locked_list_add(oem_handlers, check, cb_data)) 00202 return 0; 00203 else 00204 return ENOMEM; 00205 }
|