All Classes Files Functions Variables Pages
Dhcp.idl
Go to the documentation of this file.
1 /**
2  * @file Dhcp.idl
3  * @brief API for DHCP
4  * @version 3
5  */
6 
7 #import <common.idl>
8 
9 module webadmin {
10 
11 struct DhcpExclusion {
12  string description;
13  kerio::web::IpAddress ipStart;
14  kerio::web::IpAddress ipEnd;
15 };
16 
17 typedef sequence<DhcpExclusion> DhcpExclusionList;
18 
19 enum DhcpOptionType {
20  DhcpBool,
21  DhcpInt8,
22  DhcpInt16,
23  DhcpInt32,
24  DhcpIpAddr,
25  DhcpString,
26  DhcpHex,
27  DhcpTimeSigned,
28  DhcpTimeUnsigned,
29  DhcpInt8List,
30  DhcpInt16List,
31  DhcpInt32List,
32  DhcpIpAddrList,
33  DhcpIpPairList,
34  DhcpIpMaskList,
35  DhcpIpMaskIpList
36 };
37 
38 typedef sequence<kerio::web::IpAddressList> IpListList;
39 
40 struct DhcpOption {
41  DhcpOptionType type;
42  long optionId;
43  string name;
44 
45  /**
46  * @note: Value format: \n
47  * DHOTIpAddr - address in dot notation (192.168.0.12) \n
48  * DHOTHex - pairs of characters 0-9, a-f (12ef980ad8) \n
49  * DHOTTimexxx - number of seconds (3600) (negative only for DHOTTimeSigned) \n
50  * xxxList - values separated by ; (xxx;xx;x;xxxx) \n
51  * DHOTBool - "0" / "1"
52  */
53  /*@{ DHOTBool, DHOTInt8, DHOTInt16, DHOTInt32, DHOTIpAddr, DHOTString, DHOTHex
54  , DHOTTimeSigned, DHOTTimeUnsigned, DHOTInt8List, DHOTInt16List, DHOTInt32List, DHOTIpAddrList,*/
55  string value;
56  /*@}*/
57 
58  /*@{ DHOTIpPairList, DHOTIpMaskList, DHOTIpMaskIpList */
59  IpListList ipListList;
60  /*@}*/
61 };
62 
63 typedef sequence<DhcpOption> DhcpOptionList;
64 
65 struct DhcpScope {
66  kerio::web::KId id;
67  kerio::web::StoreStatus status;
68 
69  boolean enabled;
70  string name;
71  kerio::web::IpAddress ipStart;
72  kerio::web::IpAddress ipEnd;
73  kerio::web::IpAddress ipMask;
74 
75  DhcpExclusionList exclusions;
76 
77  DhcpOptionList options;
78 };
79 
80 typedef sequence<DhcpScope> DhcpScopeList;
81 
82 enum DhcpLeaseType {
83  DhcpTypeReservation,
84  DhcpTypeLease
85 };
86 
87 struct DhcpLease {
88  kerio::web::KId id;
89  kerio::web::KId leaseId; /// for internal purposes
90 
91  kerio::web::KId scopeId;
92  kerio::web::StoreStatus status;
93 
94  /** do not change in gui */
95  DhcpLeaseType type;
96  boolean leased;
97  boolean isRas;
98  string cardManufacturer;
99 
100  kerio::web::IpAddress ipAddress;
101  string name;
102  boolean macDefined;
103  string macAddress;
104  string hostName;
105  string userName;
106 
107  kerio::web::Date expirationDate; ///< @see SharedStructures.idl shared in lib
108  kerio::web::Time expirationTime; ///< @see SharedStructures.idl shared in lib
109 
110  kerio::web::Date requestDate; ///< @see SharedStructures.idl shared in lib
111  kerio::web::Time requestTime; ///< @see SharedStructures.idl shared in lib
112 
113  DhcpOptionList options;
114 };
115 
116 typedef sequence<DhcpLease> DhcpLeaseList;
117 
118 enum DhcpModeType {
119  DhcpAutomatic,
120  DhcpManual
121 };
122 
123 struct DhcpConfig {
124  boolean enabled;
125 };
126 
127 struct DhcpMode {
128  DhcpModeType type;
129 };
130 
131 interface Dhcp {
132 
133  /**
134  * ** SCOPES PART **
135  */
136 
137  /**
138  * get the list of scopes
139  * @param list - list of scopes and it's details
140  * @param totalItems - count of all scopes on server (before the start/limit applied)
141  * @param query - conditions and limits
142  * @throws kerio::web::ApiException \n
143  * -32001 Session expired. - "The user is not logged in." \n
144  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
145  */
146  void get(out DhcpScopeList list, out long totalItems, in kerio::web::SearchQuery query);
147 
148  /**
149  * add new scope
150  * @param errors - list of errors \n
151  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Scope is a subnet of another scope." \n
152  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Another scope is a subnet of this scope." \n
153  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Scope on the same subnet is already defined." \n
154  * 8001 Invalid params. - "Unable to add/modify DHCP scope %1. First address and Last address are from different networks."
155  * @param result - list of IDs assigned to each item
156  * @param scopes - details for new scopes. field id is assigned by the manager to temporary value until apply() or reset().
157  * @throws kerio::web::ApiException \n
158  * -32001 Session expired. - "The user is not logged in." \n
159  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
160  */
161  void create(out kerio::web::ErrorList errors, out kerio::web::CreateResultList result, in DhcpScopeList scopes);
162 
163  /**
164  * update existing scope
165  * @param errors - list of errors \n
166  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Scope is a subnet of another scope." \n
167  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Another scope is a subnet of this scope." \n
168  * 1001 Already exists. - "Unable to add/modify DHCP scope %1. Scope on the same subnet is already defined." \n
169  * 8001 Invalid params. - "Unable to add/modify DHCP scope %1. First address and Last address are from different networks."
170  * @param scopeIds - ids of scopes to be updated.
171  * @param details - details for update. Field "kerio::web::KId" is ignored. All other fields must be filled and they are written to all scopes specified by scopeIds.
172  * @throws kerio::web::ApiException \n
173  * -32001 Session expired. - "The user is not logged in." \n
174  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
175  */
176  void set(out kerio::web::ErrorList errors, in kerio::web::StringList scopeIds, in DhcpScope details);
177 
178  /**
179  * remove scope
180  * @param errors - list of errors
181  * @param scopeIds - ids of scopes that should be removed
182  * @throws kerio::web::ApiException \n
183  * -32001 Session expired. - "The user is not logged in." \n
184  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
185  */
186  void remove(out kerio::web::ErrorList errors, in kerio::web::StringList scopeIds);
187 
188  /**
189  * get generated scope information for interface
190  * @param details - configuration for given ifaceId - can be passed to create method
191  * @param ifaceId - id of interface, for which the template will be created
192  * @throws kerio::web::ApiException \n
193  * -32001 Session expired. - "The user is not logged in." \n
194  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
195  */
196  void getInterfaceTemplate(out DhcpScope details, in kerio::web::KId ifaceId);
197 
198  /**
199  * ** LEASE & RESERVATION PART **
200  */
201 
202  /**
203  * get the list of leases
204  * @param list - list of leases/reservations and it's details
205  * @param totalItems - count of all leases/reservations on server (before the start/limit applied)
206  * @param query - conditions and limits
207  * @param scopeIds - list of scope Ids, where leases should be included (empty for all scopes)
208  * @throws kerio::web::ApiException \n
209  * -32001 Session expired. - "The user is not logged in." \n
210  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
211  */
212  void getLeases(out DhcpLeaseList list, out long totalItems, in kerio::web::SearchQuery query, in kerio::web::KIdList scopeIds);
213 
214  /**
215  * add new reservation
216  * @param errors - list of errors \n
217  * 1001 Already exists. - "DHCP reservation for %1 already exists."
218  * @param result - list of IDs assigned to each item
219  * @param leases - details for new reservations. field id is assigned by the manager to temporary value until apply() or reset().
220  * @throws kerio::web::ApiException \n
221  * -32001 Session expired. - "The user is not logged in." \n
222  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
223  */
224  void createLeases(out kerio::web::ErrorList errors, out kerio::web::CreateResultList result, in DhcpLeaseList leases);
225 
226  /**
227  * update existing leases
228  * @param errors - list of errors \n
229  * 1001 Already exists. - "DHCP reservation for %1 already exists."
230  * @param leaseIds - ids of reservations to be updated.
231  * @param details - details for update. Field "kerio::web::KId" is ignored. All other fields must be filled and they are written to all scopes specified by scopeIds.
232  * @throws kerio::web::ApiException \n
233  * -32001 Session expired. - "The user is not logged in." \n
234  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
235  */
236  void setLeases(out kerio::web::ErrorList errors, in kerio::web::StringList leaseIds, in DhcpLease details);
237 
238  /**
239  * remove leases
240  * @param errors - list of errors
241  * @param leaseIds - ids of leases/reservations that should be removed
242  * @throws kerio::web::ApiException \n
243  * -32001 Session expired. - "The user is not logged in." \n
244  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
245  */
246  void removeLeases(out kerio::web::ErrorList errors, in kerio::web::StringList leaseIds);
247 
248  /**
249  * ** COMMON PART **
250  */
251 
252  /**
253  * read Dhcp mode (not part of persistent manager, returns actual state)
254  * @param mode - result
255  * @throws kerio::web::ApiException \n
256  * -32001 Session expired. - "The user is not logged in." \n
257  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
258  */
259  void getMode(out DhcpMode mode);
260 
261  /**
262  * stores Dhcp mode (not part of persistent manager, changes mode immediately)
263  * @param mode - new value
264  * @throws kerio::web::ApiException \n
265  * -32001 Session expired. - "The user is not logged in." \n
266  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
267  */
268  void setMode(in DhcpMode mode);
269 
270  /**
271  * read Dhcp configuration (not part of persistent manager, returns actual state)
272  * @param config - configuration values
273  * @throws kerio::web::ApiException \n
274  * -32001 Session expired. - "The user is not logged in." \n
275  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
276  */
277  void getConfig(out DhcpConfig config);
278 
279  /**
280  * stores Dhcp configuration (not part of persistent manager, changes settings immediately)
281  * @param config - configuration values
282  * @throws kerio::web::ApiException \n
283  * -32001 Session expired. - "The user is not logged in." \n
284  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
285  */
286  void setConfig(in DhcpConfig config);
287 
288  /**
289  * get list of all options
290  * @param options - list of all options
291  * @throws kerio::web::ApiException \n
292  * -32001 Session expired. - "The user is not logged in." \n
293  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
294  */
295  void getOptionList(out DhcpOptionList options);
296 
297  /**
298  * Returns count of declined leases in all scopes, defined by scopeIDs param
299  * @param count - count of declined leases
300  * @param scopeIds - list of scope IDs or empty for all scopes
301  * @throws kerio::web::ApiException \n
302  * -32001 Session expired. - "The user is not logged in." \n
303  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
304  */
305  void getDeclinedLeases(out long count, in kerio::web::KIdList scopeIds);
306 
307  /**
308  * Removes declined leases defined by scopeIDs param from engine
309  * @param scopeIds - list of scope IDs or empty for all scopes
310  * @throws kerio::web::ApiException \n
311  * -32001 Session expired. - "The user is not logged in." \n
312  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
313  */
314  void removeDeclinedLeases(in kerio::web::KIdList scopeIds);
315 
316  /**
317  * write changes cached in manager to configuration
318  * @param errors - list of errors \n
319  * 8001 Invalid params. - "Unable to add/modify DHCP reservation %1, wrong parameters." \n
320  * 8001 Invalid params. - "Unable to add/modify DHCP scope %1. Wrong address scope or mask." \n
321  * 8002 Database error. - "Unable to add/modify DHCP reservation %1." \n
322  * 8002 Database error. - "Unable to delete the DHCP reservation." \n
323  * 8002 Database error. - "Unable to add/modify DHCP scope %1." \n
324  * 8002 Database error. - "Unable to delete the DHCP scope."
325  * @throws kerio::web::ApiException \n
326  * -32001 Session expired. - "The user is not logged in." \n
327  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
328  */
329  void apply(out kerio::web::ErrorList errors);
330 
331  /**
332  * discard changes cached in manager
333  * @throws kerio::web::ApiException \n
334  * -32001 Session expired. - "The user is not logged in." \n
335  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
336  */
337  void reset();
338 
339 };
340 
341 }; //webadmin
Common Kerio Control structures, enums and types.
Definition: SharedStructures.idl:139
kerio::web::Date requestDate
Definition: Dhcp.idl:110
Definition: Dhcp.idl:87
Definition: Dhcp.idl:127
kerio::web::KId scopeId
for internal purposes
Definition: Dhcp.idl:91
kerio::web::Time requestTime
Definition: Dhcp.idl:111
Definition: Dhcp.idl:123
Definition: SharedStructures.idl:270
Definition: Dhcp.idl:131
Definition: Dhcp.idl:11
string value
Definition: Dhcp.idl:55
Definition: SharedStructures.idl:279
kerio::web::Time expirationTime
Definition: Dhcp.idl:108
kerio::web::Date expirationDate
Definition: Dhcp.idl:107
Definition: Accounting.idl:11
DhcpLeaseType type
Definition: Dhcp.idl:95
Definition: Dhcp.idl:40
Definition: Dhcp.idl:65