~ubuntu-branches/ubuntu/precise/openipmi/precise

« back to all changes in this revision

Viewing changes to lib/ipmi.c

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2005-10-20 23:01:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051020230155-32ns8hnb1es8hntb
Tags: 2.0.2-2
added missing libgdbm-dev to libopenipmi-dev
(closes: Bug#334623)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
#if defined(DEBUG_MSG) || defined(DEBUG_RAWMSG)
53
53
static void
54
 
dump_hex(void *vdata, int len)
 
54
dump_hex(const void *vdata, int len)
55
55
{
56
 
    unsigned char *data = vdata;
 
56
    const unsigned char *data = vdata;
57
57
    int i;
58
58
    for (i=0; i<len; i++) {
59
59
        if ((i != 0) && ((i % 16) == 0)) {
86
86
}
87
87
 
88
88
void
89
 
ipmi_log(enum ipmi_log_type_e log_type, char *format, ...)
 
89
ipmi_log(enum ipmi_log_type_e log_type, const char *format, ...)
90
90
{
91
91
    va_list ap;
92
92
 
246
246
};
247
247
 
248
248
unsigned int
249
 
ipmi_get_device_string(unsigned char        **pinput,
 
249
ipmi_get_device_string(unsigned char        ** const pinput,
250
250
                       unsigned int         in_len,
251
251
                       char                 *output,
252
252
                       int                  semantics,
392
392
};
393
393
 
394
394
static void
395
 
ipmi_set_bcdplus(char          *input,
 
395
ipmi_set_bcdplus(const char    *input,
396
396
                 unsigned int  in_len,
397
397
                 unsigned char *output,
398
398
                 int           *out_len)
399
399
{
400
 
    int  len = *out_len;
401
 
    char *s = input;
402
 
    int  pos = 0;
403
 
    int  bit = 0;
404
 
    int  count = 0;
 
400
    int        len = *out_len;
 
401
    const char *s = input;
 
402
    int        pos = 0;
 
403
    int        bit = 0;
 
404
    int        count = 0;
405
405
 
406
406
    while (in_len > 0) {
407
407
        switch(bit) {
429
429
}
430
430
 
431
431
static void
432
 
ipmi_set_6_bit_ascii(char          *input,
 
432
ipmi_set_6_bit_ascii(const char    *input,
433
433
                     unsigned int  in_len,
434
434
                     unsigned char *output,
435
435
                     int           *out_len)
436
436
{
437
 
    int  len = *out_len;
438
 
    char *s = input;
439
 
    int  pos = 0;
440
 
    int  bit = 0;
441
 
    int  count = 0;
442
 
    int  cval;
443
 
    int  oval;
 
437
    int        len = *out_len;
 
438
    const char *s = input;
 
439
    int        pos = 0;
 
440
    int        bit = 0;
 
441
    int        count = 0;
 
442
    int        cval;
 
443
    int        oval;
444
444
 
445
445
    while (in_len > 0) {
446
446
        cval = *s;
488
488
}
489
489
 
490
490
static void
491
 
ipmi_set_8_bit_ascii(char          *input,
 
491
ipmi_set_8_bit_ascii(const char    *input,
492
492
                     int           in_len,
493
493
                     unsigned char *output,
494
494
                     int           *out_len)
513
513
}
514
514
 
515
515
void
516
 
ipmi_set_device_string(char                 *input,
 
516
ipmi_set_device_string(const char           *input,
517
517
                       enum ipmi_str_type_e type,
518
518
                       unsigned int         in_len,
519
519
                       unsigned char        *output,
520
520
                       int                  force_unicode,
521
521
                       int                  *out_len)
522
522
{
523
 
    char         *s = input;
 
523
    const char   *s = input;
524
524
    int          bsize = 0; /* Start with 4-bit. */
525
525
    unsigned int i;
526
526
 
887
887
int _ipmi_aes_cbc_init(void);
888
888
int _ipmi_hmac_init(void);
889
889
int _ipmi_md5_init(void);
 
890
int _ipmi_fru_init(void);
 
891
void _ipmi_fru_shutdown(void);
890
892
 
891
893
void ipmi_oem_atca_conn_shutdown(void);
892
894
void ipmi_oem_intel_shutdown(void);
945
947
    if (rv)
946
948
        goto out_err;
947
949
 
 
950
    rv = _ipmi_fru_init();
 
951
    if (rv)
 
952
        goto out_err;
 
953
 
948
954
    /* Call the OEM handlers. */
949
955
    ipmi_oem_force_conn_init();
950
956
    ipmi_oem_motorola_mxp_init();
963
969
    ipmi_oem_intel_shutdown();
964
970
    _ipmi_mc_shutdown();
965
971
    _ipmi_domain_shutdown();
 
972
    _ipmi_fru_shutdown();
966
973
    if (seq_lock)
967
974
        handler->destroy_lock(ipmi_os_handler, seq_lock);
968
975
    ipmi_os_handler = NULL;
982
989
    _ipmi_mc_shutdown();
983
990
    _ipmi_domain_shutdown();
984
991
    _ipmi_conn_shutdown();
 
992
    _ipmi_fru_shutdown();
985
993
    if (seq_lock)
986
994
        ipmi_os_handler->destroy_lock(ipmi_os_handler, seq_lock);
987
995
}
1542
1550
#define IPMI_SNMP_DATE_OFFSET 883612800
1543
1551
 
1544
1552
int
1545
 
ipmi_handle_snmp_trap_data(void            *src_addr,
1546
 
                           unsigned int    src_addr_len,
1547
 
                           int             src_addr_type,
1548
 
                           long            specific,
1549
 
                           unsigned char   *data,
1550
 
                           unsigned int    data_len)
 
1553
ipmi_handle_snmp_trap_data(const void          *src_addr,
 
1554
                           unsigned int        src_addr_len,
 
1555
                           int                 src_addr_type,
 
1556
                           long                specific,
 
1557
                           const unsigned char *data,
 
1558
                           unsigned int        data_len)
1551
1559
{
1552
1560
    int           handled = 0;
1553
1561
    unsigned char pet_ack[12];
1712
1720
void
1713
1721
ipmi_handle_rsp_item_copyall(ipmi_con_t            *ipmi,
1714
1722
                             ipmi_msgi_t           *rspi,
1715
 
                             ipmi_addr_t           *addr,
 
1723
                             const ipmi_addr_t     *addr,
1716
1724
                             unsigned int          addr_len,
1717
 
                             ipmi_msg_t            *msg,
 
1725
                             const ipmi_msg_t      *msg,
1718
1726
                             ipmi_ll_rsp_handler_t rsp_handler)
1719
1727
{
1720
1728
    int used = IPMI_MSG_ITEM_NOT_USED;
1736
1744
void
1737
1745
ipmi_handle_rsp_item_copymsg(ipmi_con_t            *ipmi,
1738
1746
                             ipmi_msgi_t           *rspi,
1739
 
                             ipmi_msg_t            *msg,
 
1747
                             const ipmi_msg_t      *msg,
1740
1748
                             ipmi_ll_rsp_handler_t rsp_handler)
1741
1749
{
1742
1750
    int used = IPMI_MSG_ITEM_NOT_USED;