345
345
unsigned int option_activate_if_possible : 1;
346
346
unsigned int option_local_only : 1;
347
347
unsigned int option_local_only_set : 1;
348
unsigned int option_use_cache : 1;
350
351
/* A list of all domains in the system. */
865
setup_domain(const char *name,
868
ipmi_domain_t **new_domain)
866
process_options(ipmi_domain_t *domain,
867
ipmi_open_option_t *options,
868
unsigned int num_options)
872
/* Option processing. */
873
for (i=0; i<num_options; i++) {
874
switch (options[i].option) {
875
case IPMI_OPEN_OPTION_ALL:
876
domain->option_all = options[i].ival != 0;
878
case IPMI_OPEN_OPTION_SDRS:
879
domain->option_SDRs = options[i].ival != 0;
881
case IPMI_OPEN_OPTION_FRUS:
882
domain->option_FRUs = options[i].ival != 0;
884
case IPMI_OPEN_OPTION_SEL:
885
domain->option_SEL = options[i].ival != 0;
887
case IPMI_OPEN_OPTION_IPMB_SCAN:
888
domain->option_IPMB_scan = options[i].ival != 0;
890
case IPMI_OPEN_OPTION_OEM_INIT:
891
domain->option_OEM_init = options[i].ival != 0;
893
case IPMI_OPEN_OPTION_SET_EVENT_RCVR:
894
domain->option_set_event_rcvr = options[i].ival != 0;
896
case IPMI_OPEN_OPTION_SET_SEL_TIME:
897
domain->option_set_sel_time = options[i].ival != 0;
899
case IPMI_OPEN_OPTION_USE_CACHE:
900
domain->option_use_cache = options[i].ival != 0;
902
case IPMI_OPEN_OPTION_ACTIVATE_IF_POSSIBLE:
903
domain->option_activate_if_possible = options[i].ival != 0;
905
case IPMI_OPEN_OPTION_LOCAL_ONLY:
906
domain->option_local_only = options[i].ival != 0;
907
domain->option_local_only_set = 1;
918
setup_domain(const char *name,
921
ipmi_open_option_t *options,
922
unsigned int num_options,
923
ipmi_domain_t **new_domain)
870
925
struct timeval timeout;
871
926
ipmi_domain_t *domain;
873
928
ipmi_system_interface_addr_t si;
876
932
/* Don't allow '(' in the domain name, as that messes up the
877
933
naming. That is the only restriction. */
890
946
domain->option_activate_if_possible = 1;
891
947
domain->option_local_only = 0;
892
948
domain->option_local_only_set = 0;
949
domain->option_use_cache = 1;
951
priv = IPMI_PRIVILEGE_ADMIN;
952
for (i=0; i<num_con; i++) {
953
/* Find the least-common demominator privilege for the
955
if ((ipmi[i]->priv_level != 0) && (ipmi[i]->priv_level < priv))
956
priv = ipmi[i]->priv_level;
959
/* Enable setting the event receiver (by default) if the privilege
960
is admin or greater. */
961
domain->option_set_event_rcvr = (priv >= IPMI_PRIVILEGE_ADMIN);
962
domain->option_set_sel_time = (priv >= IPMI_PRIVILEGE_ADMIN);
965
process_options(domain, options, num_options);
894
967
strncpy(domain->name, name, sizeof(domain->name)-2);
895
968
i = strlen(domain->name);
5447
process_options(ipmi_domain_t *domain,
5448
ipmi_open_option_t *options,
5449
unsigned int num_options)
5453
/* Option processing. */
5454
for (i=0; i<num_options; i++) {
5455
switch (options[i].option) {
5456
case IPMI_OPEN_OPTION_ALL:
5457
domain->option_all = options[i].ival != 0;
5459
case IPMI_OPEN_OPTION_SDRS:
5460
domain->option_SDRs = options[i].ival != 0;
5462
case IPMI_OPEN_OPTION_FRUS:
5463
domain->option_FRUs = options[i].ival != 0;
5465
case IPMI_OPEN_OPTION_SEL:
5466
domain->option_SEL = options[i].ival != 0;
5468
case IPMI_OPEN_OPTION_IPMB_SCAN:
5469
domain->option_IPMB_scan = options[i].ival != 0;
5471
case IPMI_OPEN_OPTION_OEM_INIT:
5472
domain->option_OEM_init = options[i].ival != 0;
5474
case IPMI_OPEN_OPTION_SET_EVENT_RCVR:
5475
domain->option_set_event_rcvr = options[i].ival != 0;
5477
case IPMI_OPEN_OPTION_SET_SEL_TIME:
5478
domain->option_set_sel_time = options[i].ival != 0;
5480
case IPMI_OPEN_OPTION_ACTIVATE_IF_POSSIBLE:
5481
domain->option_activate_if_possible = options[i].ival != 0;
5483
case IPMI_OPEN_OPTION_LOCAL_ONLY:
5484
domain->option_local_only = options[i].ival != 0;
5485
domain->option_local_only_set = 1;
5496
5526
ipmi_open_domain(const char *name,
5497
5527
ipmi_con_t *con[],
5508
5538
ipmi_domain_t *domain = NULL;
5509
5539
unsigned int i;
5512
5541
if ((num_con < 1) || (num_con > MAX_CONS))
5515
rv = setup_domain(name, con, num_con, &domain);
5544
rv = setup_domain(name, con, num_con, options, num_options, &domain);
5520
5549
domain->domain_fully_up_cb_data = domain_fully_up_cb_data;
5521
5550
domain->fully_up_count = 1;
5523
priv = IPMI_PRIVILEGE_ADMIN;
5524
5552
for (i=0; i<num_con; i++) {
5525
/* Find the least-common demominator privilege for the
5527
if ((con[i]->priv_level != 0) && (con[i]->priv_level < priv))
5528
priv = con[i]->priv_level;
5529
5553
rv = con[i]->add_con_change_handler(con[i], ll_con_changed, domain);
5537
/* Enable setting the event receiver (by default) if the privilege
5538
is admin or greater. */
5539
domain->option_set_event_rcvr = (priv >= IPMI_PRIVILEGE_ADMIN);
5540
domain->option_set_sel_time = (priv >= IPMI_PRIVILEGE_ADMIN);
5542
process_options(domain, options, num_options);
5544
5561
add_known_domain(domain);
5546
5563
if (con_change_handler) {
6571
6588
if ((num_con < 1) || (num_con > MAX_CONS))
6574
rv = setup_domain("", con, num_con, &domain);
6591
rv = setup_domain("", con, num_con, NULL, 0, &domain);