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

« back to all changes in this revision

Viewing changes to lib/ipmi_lan.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:
381
381
extern ipmi_payload_t _ipmi_payload;
382
382
 
383
383
static int
384
 
open_format_msg(ipmi_con_t    *ipmi,
385
 
                ipmi_addr_t   *addr,
386
 
                unsigned int  addr_len,
387
 
                ipmi_msg_t    *msg,
388
 
                unsigned char *out_data,
389
 
                unsigned int  *out_data_len,
390
 
                int           *out_of_session,
391
 
                unsigned char seq)
 
384
open_format_msg(ipmi_con_t        *ipmi,
 
385
                const ipmi_addr_t *addr,
 
386
                unsigned int      addr_len,
 
387
                const ipmi_msg_t  *msg,
 
388
                unsigned char     *out_data,
 
389
                unsigned int      *out_data_len,
 
390
                int               *out_of_session,
 
391
                unsigned char     seq)
392
392
{
393
393
    unsigned char *tmsg = out_data;
394
394
 
1305
1305
static lan_link_t lan_ip_list[LAN_HASH_SIZE];
1306
1306
 
1307
1307
static int
1308
 
hash_lan(ipmi_con_t *ipmi)
 
1308
hash_lan(const ipmi_con_t *ipmi)
1309
1309
{
1310
1310
    int idx;
1311
1311
 
1316
1316
}
1317
1317
 
1318
1318
static int
1319
 
hash_lan_addr(struct sockaddr *addr)
 
1319
hash_lan_addr(const struct sockaddr *addr)
1320
1320
{
1321
1321
    int idx;
1322
1322
    switch (addr->sa_family)
1705
1705
}
1706
1706
 
1707
1707
static int
1708
 
lan_send_addr(lan_data_t  *lan,
1709
 
              ipmi_addr_t *addr,
1710
 
              int         addr_len,
1711
 
              ipmi_msg_t  *msg,
1712
 
              uint8_t     seq,
1713
 
              int         addr_num)
 
1708
lan_send_addr(lan_data_t        *lan,
 
1709
              const ipmi_addr_t *addr,
 
1710
              int               addr_len,
 
1711
              const ipmi_msg_t  *msg,
 
1712
              uint8_t           seq,
 
1713
              int               addr_num)
1714
1714
{
1715
1715
    unsigned char  data[IPMI_MAX_LAN_LEN+IPMI_LAN_MAX_HEADER];
1716
1716
    unsigned char  *tmsg;
1839
1839
}
1840
1840
 
1841
1841
static int
1842
 
lan_send(lan_data_t  *lan,
1843
 
         ipmi_addr_t *addr,
1844
 
         int         addr_len,
1845
 
         ipmi_msg_t  *msg,
1846
 
         uint8_t     seq,
1847
 
         int         *send_ip_num)
 
1842
lan_send(lan_data_t        *lan,
 
1843
         const ipmi_addr_t *addr,
 
1844
         int               addr_len,
 
1845
         const ipmi_msg_t  *msg,
 
1846
         uint8_t           seq,
 
1847
         int               *send_ip_num)
1848
1848
{
1849
1849
    int curr_ip_addr;
1850
1850
 
2389
2389
 
2390
2390
typedef struct call_event_handler_s
2391
2391
{
2392
 
    lan_data_t   *lan;
2393
 
    ipmi_addr_t  *addr;
2394
 
    unsigned int addr_len;
2395
 
    ipmi_event_t *event;
 
2392
    lan_data_t        *lan;
 
2393
    const ipmi_addr_t *addr;
 
2394
    unsigned int      addr_len;
 
2395
    ipmi_event_t      *event;
2396
2396
} call_event_handler_t;
2397
2397
 
2398
2398
static int
2434
2434
static ipmi_mcid_t invalid_mcid = IPMI_MCID_INVALID;
2435
2435
 
2436
2436
static void
2437
 
handle_async_event(ipmi_con_t   *ipmi,
2438
 
                   ipmi_addr_t  *addr,
2439
 
                   unsigned int addr_len,
2440
 
                   ipmi_msg_t   *msg)
 
2437
handle_async_event(ipmi_con_t        *ipmi,
 
2438
                   const ipmi_addr_t *addr,
 
2439
                   unsigned int      addr_len,
 
2440
                   const ipmi_msg_t  *msg)
2441
2441
{
2442
2442
    lan_data_t           *lan = (lan_data_t *) ipmi->con_data;
2443
2443
    ipmi_event_t         *event = NULL;
2479
2479
static int
2480
2480
handle_msg_send(lan_timer_info_t      *info,
2481
2481
                int                   addr_num,
2482
 
                ipmi_addr_t           *addr,
 
2482
                const ipmi_addr_t     *addr,
2483
2483
                unsigned int          addr_len,
2484
 
                ipmi_msg_t            *msg,
 
2484
                const ipmi_msg_t      *msg,
2485
2485
                ipmi_ll_rsp_handler_t rsp_handler,
2486
2486
                ipmi_msgi_t           *rspi)
2487
2487
{
2488
 
    ipmi_con_t     *ipmi = info->ipmi;
2489
 
    lan_data_t     *lan = ipmi->con_data;
2490
 
    unsigned int   seq;
2491
 
    struct timeval timeout;
2492
 
    int            rv;
2493
 
    ipmi_addr_t    tmp_addr;
2494
 
    ipmi_addr_t    *orig_addr = NULL;
2495
 
    unsigned int   orig_addr_len = 0;
 
2488
    ipmi_con_t        *ipmi = info->ipmi;
 
2489
    lan_data_t        *lan = ipmi->con_data;
 
2490
    unsigned int      seq;
 
2491
    struct timeval    timeout;
 
2492
    int               rv;
 
2493
    ipmi_addr_t       tmp_addr;
 
2494
    const ipmi_addr_t *orig_addr = NULL;
 
2495
    unsigned int      orig_addr_len = 0;
2496
2496
 
2497
2497
    seq = (lan->last_seq + 1) % 64;
2498
2498
    if (seq == 0)
3423
3423
 
3424
3424
static int
3425
3425
lan_send_command(ipmi_con_t            *ipmi,
3426
 
                 ipmi_addr_t           *addr,
 
3426
                 const ipmi_addr_t     *addr,
3427
3427
                 unsigned int          addr_len,
3428
 
                 ipmi_msg_t            *msg,
 
3428
                 const ipmi_msg_t      *msg,
3429
3429
                 ipmi_ll_rsp_handler_t rsp_handler,
3430
3430
                 ipmi_msgi_t           *trspi)
3431
3431
{
3530
3530
}
3531
3531
 
3532
3532
static int
3533
 
lan_send_response(ipmi_con_t   *ipmi,
3534
 
                  ipmi_addr_t  *addr,
3535
 
                  unsigned int addr_len,
3536
 
                  ipmi_msg_t   *msg,
3537
 
                  long         sequence)
 
3533
lan_send_response(ipmi_con_t        *ipmi,
 
3534
                  const ipmi_addr_t *addr,
 
3535
                  unsigned int      addr_len,
 
3536
                  const ipmi_msg_t  *msg,
 
3537
                  long              sequence)
3538
3538
{
3539
3539
    return ENOSYS;
3540
3540
}
5361
5361
}
5362
5362
 
5363
5363
static void
5364
 
snmp_got_match(lan_data_t *lan, ipmi_msg_t *msg, unsigned char *pet_ack)
 
5364
snmp_got_match(lan_data_t          *lan,
 
5365
               const ipmi_msg_t    *msg,
 
5366
               const unsigned char *pet_ack)
5365
5367
{
5366
5368
    ipmi_system_interface_addr_t si;
5367
5369
    ipmi_msg_t                   ack;
5375
5377
    /* Send the ack directly. */
5376
5378
    ack.netfn = IPMI_SENSOR_EVENT_NETFN;
5377
5379
    ack.cmd = IPMI_PET_ACKNOWLEDGE_CMD;
5378
 
    ack.data = pet_ack;
 
5380
    ack.data = (unsigned char *) pet_ack;
5379
5381
    ack.data_len = 12;
5380
5382
    lan_send(lan, (ipmi_addr_t *) &si, sizeof(si), &ack, 0, &dummy_send_ip);
5381
5383
}
5387
5389
} lan_do_evt_t;
5388
5390
 
5389
5391
int
5390
 
ipmi_lan_handle_external_event(struct sockaddr *src_addr,
5391
 
                               ipmi_msg_t      *msg,
5392
 
                               unsigned char   *pet_ack)
 
5392
ipmi_lan_handle_external_event(const struct sockaddr *src_addr,
 
5393
                               const ipmi_msg_t      *msg,
 
5394
                               const unsigned char   *pet_ack)
5393
5395
{
5394
5396
    lan_link_t   *l;
5395
5397
    lan_data_t   *lan;