17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24ba3594baSGarrett D'Amore * 257c478bd9Sstevel@tonic-gate * Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. 267c478bd9Sstevel@tonic-gate * Use is subject to license terms. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _SYS_CONFIG_ADMIN_H 307c478bd9Sstevel@tonic-gate #define _SYS_CONFIG_ADMIN_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * config_admin.h 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * this file supports usage of the interfaces defined in 367c478bd9Sstevel@tonic-gate * config_admin.3x. which are contained in /usr/lib/libcfgadm.so.1 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include <sys/param.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * Defined constants 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate #define CFGA_AP_LOG_ID_LEN 20 507c478bd9Sstevel@tonic-gate #define CFGA_AP_PHYS_ID_LEN MAXPATHLEN 517c478bd9Sstevel@tonic-gate #define CFGA_INFO_LEN 4096 527c478bd9Sstevel@tonic-gate #define CFGA_TYPE_LEN 12 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #define CFGA_CLASS_LEN 12 557c478bd9Sstevel@tonic-gate #define CFGA_LOG_EXT_LEN 30 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #define CFGA_DYN_SEP "::" 587c478bd9Sstevel@tonic-gate #define CFGA_PHYS_EXT_LEN (CFGA_AP_PHYS_ID_LEN + CFGA_LOG_EXT_LEN) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * Configuration change state commands 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate typedef enum { 657c478bd9Sstevel@tonic-gate CFGA_CMD_NONE = 0, 667c478bd9Sstevel@tonic-gate CFGA_CMD_LOAD, 677c478bd9Sstevel@tonic-gate CFGA_CMD_UNLOAD, 687c478bd9Sstevel@tonic-gate CFGA_CMD_CONNECT, 697c478bd9Sstevel@tonic-gate CFGA_CMD_DISCONNECT, 707c478bd9Sstevel@tonic-gate CFGA_CMD_CONFIGURE, 717c478bd9Sstevel@tonic-gate CFGA_CMD_UNCONFIGURE 727c478bd9Sstevel@tonic-gate } cfga_cmd_t; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate /* 757c478bd9Sstevel@tonic-gate * Configuration states 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate typedef enum { 787c478bd9Sstevel@tonic-gate CFGA_STAT_NONE = 0, 797c478bd9Sstevel@tonic-gate CFGA_STAT_EMPTY, 807c478bd9Sstevel@tonic-gate CFGA_STAT_DISCONNECTED, 817c478bd9Sstevel@tonic-gate CFGA_STAT_CONNECTED, 827c478bd9Sstevel@tonic-gate CFGA_STAT_UNCONFIGURED, 837c478bd9Sstevel@tonic-gate CFGA_STAT_CONFIGURED 847c478bd9Sstevel@tonic-gate } cfga_stat_t; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* 877c478bd9Sstevel@tonic-gate * Configuration conditions 887c478bd9Sstevel@tonic-gate */ 897c478bd9Sstevel@tonic-gate typedef enum { 907c478bd9Sstevel@tonic-gate CFGA_COND_UNKNOWN = 0, 917c478bd9Sstevel@tonic-gate CFGA_COND_OK, 927c478bd9Sstevel@tonic-gate CFGA_COND_FAILING, 937c478bd9Sstevel@tonic-gate CFGA_COND_FAILED, 947c478bd9Sstevel@tonic-gate CFGA_COND_UNUSABLE 957c478bd9Sstevel@tonic-gate } cfga_cond_t; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * Flags 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate #define CFGA_FLAG_FORCE 1 1017c478bd9Sstevel@tonic-gate #define CFGA_FLAG_VERBOSE 2 1027c478bd9Sstevel@tonic-gate #define CFGA_FLAG_LIST_ALL 4 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate typedef char cfga_ap_log_id_t[CFGA_AP_LOG_ID_LEN]; 1057c478bd9Sstevel@tonic-gate typedef char cfga_ap_phys_id_t[CFGA_AP_PHYS_ID_LEN]; 1067c478bd9Sstevel@tonic-gate typedef char cfga_info_t[CFGA_INFO_LEN]; 1077c478bd9Sstevel@tonic-gate typedef char cfga_type_t[CFGA_TYPE_LEN]; 1087c478bd9Sstevel@tonic-gate typedef int cfga_flags_t; 1097c478bd9Sstevel@tonic-gate typedef int cfga_busy_t; 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate typedef char cfga_log_ext_t[CFGA_LOG_EXT_LEN]; 1137c478bd9Sstevel@tonic-gate typedef char cfga_phys_ext_t[CFGA_PHYS_EXT_LEN]; 1147c478bd9Sstevel@tonic-gate typedef char cfga_class_t[CFGA_CLASS_LEN]; 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate typedef struct cfga_list_data { 117*6e270ca8SMarcel Telka cfga_log_ext_t ap_log_id; /* Attachment point logical id */ 1187c478bd9Sstevel@tonic-gate cfga_phys_ext_t ap_phys_id; /* Attachment point physical id */ 119*6e270ca8SMarcel Telka cfga_class_t ap_class; /* Attachment point class */ 1207c478bd9Sstevel@tonic-gate cfga_stat_t ap_r_state; /* Receptacle state */ 1217c478bd9Sstevel@tonic-gate cfga_stat_t ap_o_state; /* Occupant state */ 1227c478bd9Sstevel@tonic-gate cfga_cond_t ap_cond; /* Attachment point condition */ 1237c478bd9Sstevel@tonic-gate cfga_busy_t ap_busy; /* Busy indicators */ 1247c478bd9Sstevel@tonic-gate time_t ap_status_time; /* Attachment point last change */ 1257c478bd9Sstevel@tonic-gate cfga_info_t ap_info; /* Miscellaneous information */ 1267c478bd9Sstevel@tonic-gate cfga_type_t ap_type; /* Occupant type */ 1277c478bd9Sstevel@tonic-gate } cfga_list_data_t; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * The following structure is retained for backward compatibility 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate typedef struct cfga_stat_data { 1337c478bd9Sstevel@tonic-gate cfga_ap_log_id_t ap_log_id; /* Attachment point logical id */ 1347c478bd9Sstevel@tonic-gate cfga_ap_phys_id_t ap_phys_id; /* Attachment point physical id */ 1357c478bd9Sstevel@tonic-gate cfga_stat_t ap_r_state; /* Receptacle state */ 1367c478bd9Sstevel@tonic-gate cfga_stat_t ap_o_state; /* Occupant state */ 1377c478bd9Sstevel@tonic-gate cfga_cond_t ap_cond; /* Attachment point condition */ 1387c478bd9Sstevel@tonic-gate cfga_busy_t ap_busy; /* Busy indicators */ 1397c478bd9Sstevel@tonic-gate time_t ap_status_time; /* Attachment point last change */ 1407c478bd9Sstevel@tonic-gate cfga_info_t ap_info; /* Miscellaneous information */ 1417c478bd9Sstevel@tonic-gate cfga_type_t ap_type; /* Occupant type */ 1427c478bd9Sstevel@tonic-gate } cfga_stat_data_t; 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate struct cfga_confirm { 1467c478bd9Sstevel@tonic-gate int (*confirm)(void *appdata_ptr, const char *message); 1477c478bd9Sstevel@tonic-gate void *appdata_ptr; 1487c478bd9Sstevel@tonic-gate }; 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate struct cfga_msg { 1517c478bd9Sstevel@tonic-gate int (*message_routine)(void *appdata_ptr, const char *message); 1527c478bd9Sstevel@tonic-gate void *appdata_ptr; 1537c478bd9Sstevel@tonic-gate }; 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Library function error codes returned by all functions below 1577c478bd9Sstevel@tonic-gate * except config_strerror which is used to decode the error 1587c478bd9Sstevel@tonic-gate * codes. 1597c478bd9Sstevel@tonic-gate */ 1607c478bd9Sstevel@tonic-gate typedef enum { 1617c478bd9Sstevel@tonic-gate CFGA_OK = 0, 1627c478bd9Sstevel@tonic-gate CFGA_NACK, 1637c478bd9Sstevel@tonic-gate CFGA_NOTSUPP, 1647c478bd9Sstevel@tonic-gate CFGA_OPNOTSUPP, 1657c478bd9Sstevel@tonic-gate CFGA_PRIV, 1667c478bd9Sstevel@tonic-gate CFGA_BUSY, 1677c478bd9Sstevel@tonic-gate CFGA_SYSTEM_BUSY, 1687c478bd9Sstevel@tonic-gate CFGA_DATA_ERROR, 1697c478bd9Sstevel@tonic-gate CFGA_LIB_ERROR, 1707c478bd9Sstevel@tonic-gate CFGA_NO_LIB, 1717c478bd9Sstevel@tonic-gate CFGA_INSUFFICENT_CONDITION, 1727c478bd9Sstevel@tonic-gate CFGA_INVAL, 1737c478bd9Sstevel@tonic-gate CFGA_ERROR, 1747c478bd9Sstevel@tonic-gate CFGA_APID_NOEXIST, 1757c478bd9Sstevel@tonic-gate CFGA_ATTR_INVAL 1767c478bd9Sstevel@tonic-gate } cfga_err_t; 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * config_admin.3x library interfaces 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate cfga_err_t config_change_state(cfga_cmd_t state_change_cmd, int num_ap_ids, 1847c478bd9Sstevel@tonic-gate char *const *ap_ids, const char *options, struct cfga_confirm *confp, 1857c478bd9Sstevel@tonic-gate struct cfga_msg *msgp, char **errstring, cfga_flags_t flags); 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate cfga_err_t config_private_func(const char *function, int num_ap_ids, 1887c478bd9Sstevel@tonic-gate char *const *ap_ids, const char *options, struct cfga_confirm *confp, 1897c478bd9Sstevel@tonic-gate struct cfga_msg *msgp, char **errstring, cfga_flags_t flags); 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate cfga_err_t config_test(int num_ap_ids, char *const *ap_ids, 1927c478bd9Sstevel@tonic-gate const char *options, struct cfga_msg *msgp, char **errstring, 1937c478bd9Sstevel@tonic-gate cfga_flags_t flags); 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate cfga_err_t config_list_ext(int num_ap_ids, char *const *ap_ids, 1967c478bd9Sstevel@tonic-gate struct cfga_list_data **ap_id_list, int *nlist, const char *options, 1977c478bd9Sstevel@tonic-gate const char *listopts, char **errstring, cfga_flags_t flags); 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate cfga_err_t config_help(int num_ap_ids, char *const *ap_ids, 2007c478bd9Sstevel@tonic-gate struct cfga_msg *msgp, const char *options, cfga_flags_t flags); 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate const char *config_strerror(cfga_err_t cfgerrnum); 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate int config_ap_id_cmp(const cfga_ap_log_id_t ap_id1, 2057c478bd9Sstevel@tonic-gate const cfga_ap_log_id_t ap_id2); 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate void config_unload_libs(); 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate /* 2107c478bd9Sstevel@tonic-gate * The following two routines are retained only for backward compatibility 2117c478bd9Sstevel@tonic-gate */ 2127c478bd9Sstevel@tonic-gate cfga_err_t config_stat(int num_ap_ids, char *const *ap_ids, 2137c478bd9Sstevel@tonic-gate struct cfga_stat_data *buf, const char *options, char **errstring); 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate cfga_err_t config_list(struct cfga_stat_data **ap_di_list, int *nlist, 2167c478bd9Sstevel@tonic-gate const char *options, char **errstring); 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #ifdef CFGA_PLUGIN_LIB 2207c478bd9Sstevel@tonic-gate /* 2217c478bd9Sstevel@tonic-gate * Plugin library routine hooks - only to be used by the generic 2227c478bd9Sstevel@tonic-gate * library and plugin libraries (who must define CFGA_PLUGIN_LIB 2237c478bd9Sstevel@tonic-gate * prior to the inclusion of this header). 2247c478bd9Sstevel@tonic-gate */ 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate cfga_err_t cfga_change_state(cfga_cmd_t, const char *, const char *, 2277c478bd9Sstevel@tonic-gate struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t); 2287c478bd9Sstevel@tonic-gate cfga_err_t cfga_private_func(const char *, const char *, const char *, 2297c478bd9Sstevel@tonic-gate struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t); 2307c478bd9Sstevel@tonic-gate cfga_err_t cfga_test(const char *, const char *, struct cfga_msg *, 2317c478bd9Sstevel@tonic-gate char **, cfga_flags_t); 2327c478bd9Sstevel@tonic-gate cfga_err_t cfga_list_ext(const char *, struct cfga_list_data **, int *, 2337c478bd9Sstevel@tonic-gate const char *, const char *, char **, cfga_flags_t); 2347c478bd9Sstevel@tonic-gate cfga_err_t cfga_help(struct cfga_msg *, const char *, cfga_flags_t); 2357c478bd9Sstevel@tonic-gate int cfga_ap_id_cmp(const cfga_ap_log_id_t, 2367c478bd9Sstevel@tonic-gate const cfga_ap_log_id_t); 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate /* 2407c478bd9Sstevel@tonic-gate * Plugin version information. 2417c478bd9Sstevel@tonic-gate */ 2427c478bd9Sstevel@tonic-gate #define CFGA_HSL_V1 1 2437c478bd9Sstevel@tonic-gate #define CFGA_HSL_V2 2 2447c478bd9Sstevel@tonic-gate #define CFGA_HSL_VERS CFGA_HSL_V2 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate /* 2477c478bd9Sstevel@tonic-gate * The following two routines are retained only for backward compatibility. 2487c478bd9Sstevel@tonic-gate */ 2497c478bd9Sstevel@tonic-gate cfga_err_t cfga_stat(const char *, struct cfga_stat_data *, 2507c478bd9Sstevel@tonic-gate const char *, char **); 2517c478bd9Sstevel@tonic-gate cfga_err_t cfga_list(const char *, struct cfga_stat_data **, int *, 2527c478bd9Sstevel@tonic-gate const char *, char **); 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate #endif /* CFGA_PLUGIN_LIB */ 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2587c478bd9Sstevel@tonic-gate } 2597c478bd9Sstevel@tonic-gate #endif 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate #endif /* _SYS_CONFIG_ADMIN_H */ 262