libdladm.h (149b7eb2) libdladm.h (da14cebe)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 12 unchanged lines hidden (view full) ---

21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _LIBDLADM_H
27#define _LIBDLADM_H
28
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 12 unchanged lines hidden (view full) ---

21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _LIBDLADM_H
27#define _LIBDLADM_H
28
29#include <sys/dls.h>
29#include <sys/dls_mgmt.h>
30#include <sys/dlpi.h>
31
32/*
33 * This file includes structures, macros and common routines shared by all
34 * data-link administration, and routines which do not directly administrate
35 * links. For example, dladm_status2str().
36 */
37

--- 17 unchanged lines hidden (view full) ---

55 * - DLADM_OPT_CREATE:
56 * Today, only used by dladm_set_secobj() - requests to create a secobj.
57 *
58 * - DLADM_OPT_FORCE:
59 * The function requests to execute a specific operation forcefully.
60 *
61 * - DLADM_OPT_PREFIX:
62 * The function requests to generate a link name using the specified prefix.
30#include <sys/dlpi.h>
31
32/*
33 * This file includes structures, macros and common routines shared by all
34 * data-link administration, and routines which do not directly administrate
35 * links. For example, dladm_status2str().
36 */
37

--- 17 unchanged lines hidden (view full) ---

55 * - DLADM_OPT_CREATE:
56 * Today, only used by dladm_set_secobj() - requests to create a secobj.
57 *
58 * - DLADM_OPT_FORCE:
59 * The function requests to execute a specific operation forcefully.
60 *
61 * - DLADM_OPT_PREFIX:
62 * The function requests to generate a link name using the specified prefix.
63 *
64 * - DLADM_OPT_VLAN:
65 * Signifies VLAN creation code path
66 *
67 * - DLADM_OPT_HWRINGS:
68 * Requires a hardware group of rings when creating a vnic.
63 */
64#define DLADM_OPT_ACTIVE 0x00000001
65#define DLADM_OPT_PERSIST 0x00000002
66#define DLADM_OPT_CREATE 0x00000004
67#define DLADM_OPT_FORCE 0x00000008
68#define DLADM_OPT_PREFIX 0x00000010
69 */
70#define DLADM_OPT_ACTIVE 0x00000001
71#define DLADM_OPT_PERSIST 0x00000002
72#define DLADM_OPT_CREATE 0x00000004
73#define DLADM_OPT_FORCE 0x00000008
74#define DLADM_OPT_PREFIX 0x00000010
75#define DLADM_OPT_ANCHOR 0x00000020
76#define DLADM_OPT_VLAN 0x00000040
77#define DLADM_OPT_HWRINGS 0x00000080
69
70#define DLADM_WALK_TERMINATE 0
71#define DLADM_WALK_CONTINUE -1
72
78
79#define DLADM_WALK_TERMINATE 0
80#define DLADM_WALK_CONTINUE -1
81
82#define DLADM_MAX_ARG_CNT 32
83#define DLADM_MAX_ARG_VALS 32
84
73typedef enum {
74 DLADM_STATUS_OK = 0,
75 DLADM_STATUS_BADARG,
76 DLADM_STATUS_FAILED,
77 DLADM_STATUS_TOOSMALL,
78 DLADM_STATUS_NOTSUP,
79 DLADM_STATUS_NOTFOUND,
80 DLADM_STATUS_BADVAL,

--- 13 unchanged lines hidden (view full) ---

94 DLADM_STATUS_MACADDRINVAL,
95 DLADM_STATUS_KEYINVAL,
96 DLADM_STATUS_INVALIDMACADDRLEN,
97 DLADM_STATUS_INVALIDMACADDRTYPE,
98 DLADM_STATUS_LINKBUSY,
99 DLADM_STATUS_VIDINVAL,
100 DLADM_STATUS_NONOTIF,
101 DLADM_STATUS_TRYAGAIN,
85typedef enum {
86 DLADM_STATUS_OK = 0,
87 DLADM_STATUS_BADARG,
88 DLADM_STATUS_FAILED,
89 DLADM_STATUS_TOOSMALL,
90 DLADM_STATUS_NOTSUP,
91 DLADM_STATUS_NOTFOUND,
92 DLADM_STATUS_BADVAL,

--- 13 unchanged lines hidden (view full) ---

106 DLADM_STATUS_MACADDRINVAL,
107 DLADM_STATUS_KEYINVAL,
108 DLADM_STATUS_INVALIDMACADDRLEN,
109 DLADM_STATUS_INVALIDMACADDRTYPE,
110 DLADM_STATUS_LINKBUSY,
111 DLADM_STATUS_VIDINVAL,
112 DLADM_STATUS_NONOTIF,
113 DLADM_STATUS_TRYAGAIN,
102 DLADM_STATUS_NOTDEFINED
114 DLADM_STATUS_BADTIMEVAL,
115 DLADM_STATUS_INVALIDMACADDR,
116 DLADM_STATUS_INVALIDMACADDRNIC,
117 DLADM_STATUS_INVALIDMACADDRINUSE,
118 DLADM_STATUS_MACFACTORYSLOTINVALID,
119 DLADM_STATUS_MACFACTORYSLOTUSED,
120 DLADM_STATUS_MACFACTORYSLOTALLUSED,
121 DLADM_STATUS_MACFACTORYNOTSUP,
122 DLADM_STATUS_INVALIDMACPREFIX,
123 DLADM_STATUS_INVALIDMACPREFIXLEN,
124 DLADM_STATUS_CPUMAX,
125 DLADM_STATUS_CPUERR,
126 DLADM_STATUS_CPUNOTONLINE,
127 DLADM_STATUS_DB_NOTFOUND,
128 DLADM_STATUS_DB_PARSE_ERR,
129 DLADM_STATUS_PROP_PARSE_ERR,
130 DLADM_STATUS_ATTR_PARSE_ERR,
131 DLADM_STATUS_FLOW_DB_ERR,
132 DLADM_STATUS_FLOW_DB_OPEN_ERR,
133 DLADM_STATUS_FLOW_DB_PARSE_ERR,
134 DLADM_STATUS_FLOWPROP_DB_PARSE_ERR,
135 DLADM_STATUS_FLOW_ADD_ERR,
136 DLADM_STATUS_FLOW_WALK_ERR,
137 DLADM_STATUS_FLOW_IDENTICAL,
138 DLADM_STATUS_FLOW_INCOMPATIBLE,
139 DLADM_STATUS_FLOW_EXISTS,
140 DLADM_STATUS_PERSIST_FLOW_EXISTS,
141 DLADM_STATUS_INVALID_IP,
142 DLADM_STATUS_INVALID_PREFIXLEN,
143 DLADM_STATUS_INVALID_PROTOCOL,
144 DLADM_STATUS_INVALID_PORT,
145 DLADM_STATUS_INVALID_DSF,
146 DLADM_STATUS_INVALID_DSFMASK,
147 DLADM_STATUS_INVALID_MACMARGIN,
148 DLADM_STATUS_NOTDEFINED,
149 DLADM_STATUS_BADPROP,
150 DLADM_STATUS_MINMAXBW,
151 DLADM_STATUS_NO_HWRINGS
103} dladm_status_t;
104
105typedef enum {
106 DLADM_TYPE_STR,
107 DLADM_TYPE_BOOLEAN,
108 DLADM_TYPE_UINT64
109} dladm_datatype_t;
110
111typedef int dladm_conf_t;
112#define DLADM_INVALID_CONF 0
113
152} dladm_status_t;
153
154typedef enum {
155 DLADM_TYPE_STR,
156 DLADM_TYPE_BOOLEAN,
157 DLADM_TYPE_UINT64
158} dladm_datatype_t;
159
160typedef int dladm_conf_t;
161#define DLADM_INVALID_CONF 0
162
163typedef struct dladm_arg_info {
164 const char *ai_name;
165 char *ai_val[DLADM_MAX_ARG_VALS];
166 uint_t ai_count;
167} dladm_arg_info_t;
168
169typedef struct dladm_arg_list {
170 dladm_arg_info_t al_info[DLADM_MAX_ARG_CNT];
171 uint_t al_count;
172 char *al_buf;
173} dladm_arg_list_t;
174
175typedef enum {
176 DLADM_LOGTYPE_LINK = 1,
177 DLADM_LOGTYPE_FLOW
178} dladm_logtype_t;
179
180typedef struct dladm_usage {
181 char du_name[MAXLINKNAMELEN];
182 uint64_t du_duration;
183 uint64_t du_stime;
184 uint64_t du_etime;
185 uint64_t du_ipackets;
186 uint64_t du_rbytes;
187 uint64_t du_opackets;
188 uint64_t du_obytes;
189 uint64_t du_bandwidth;
190 boolean_t du_last;
191} dladm_usage_t;
192
114extern const char *dladm_status2str(dladm_status_t, char *);
115extern dladm_status_t dladm_set_rootdir(const char *);
116extern const char *dladm_class2str(datalink_class_t, char *);
117extern const char *dladm_media2str(uint32_t, char *);
118extern boolean_t dladm_valid_linkname(const char *);
193extern const char *dladm_status2str(dladm_status_t, char *);
194extern dladm_status_t dladm_set_rootdir(const char *);
195extern const char *dladm_class2str(datalink_class_t, char *);
196extern const char *dladm_media2str(uint32_t, char *);
197extern boolean_t dladm_valid_linkname(const char *);
198extern dladm_status_t dladm_str2bw(char *, uint64_t *);
199extern const char *dladm_bw2str(int64_t, char *);
119
200
201extern dladm_status_t dladm_parse_flow_props(char *, dladm_arg_list_t **,
202 boolean_t);
203extern dladm_status_t dladm_parse_link_props(char *, dladm_arg_list_t **,
204 boolean_t);
205extern void dladm_free_props(dladm_arg_list_t *);
206extern dladm_status_t dladm_parse_flow_attrs(char *, dladm_arg_list_t **,
207 boolean_t);
208extern void dladm_free_attrs(dladm_arg_list_t *);
209
210extern dladm_status_t dladm_start_usagelog(dladm_logtype_t, uint_t);
211extern dladm_status_t dladm_stop_usagelog(dladm_logtype_t);
212extern dladm_status_t dladm_walk_usage_res(int (*)(dladm_usage_t *, void *),
213 int, char *, char *, char *, char *, void *);
214extern dladm_status_t dladm_walk_usage_time(int (*)(dladm_usage_t *, void *),
215 int, char *, char *, char *, void *);
216extern dladm_status_t dladm_usage_summary(int (*)(dladm_usage_t *, void *),
217 int, char *, void *);
218extern dladm_status_t dladm_usage_dates(int (*)(dladm_usage_t *, void *),
219 int, char *, char *, void *);
220
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* _LIBDLADM_H */
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* _LIBDLADM_H */