1 /* -*- c -*- 2 * admin_protocol.x: private protocol for communicating between 3 * remote_internal driver and libvirtd. This protocol is 4 * internal and may change at any time. 5 * 6 * Copyright (C) 2014-2015 Red Hat, Inc. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library. If not, see 20 * <http://www.gnu.org/licenses/>. 21 */ 22 23 %#include <libvirt/libvirt-admin.h> 24 %#include "virxdrdefs.h" 25 26 /*----- Data types. -----*/ 27 28 /* Length of long, but not unbounded, strings. 29 * This is an arbitrary limit designed to stop the decoder from trying 30 * to allocate unbounded amounts of memory when fed with a bad message. 31 */ 32 const ADMIN_STRING_MAX = 4194304; 33 34 /* Upper limit on list of servers */ 35 const ADMIN_SERVER_LIST_MAX = 16384; 36 37 /* Upper limit on number of threadpool parameters */ 38 const ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX = 32; 39 40 /* Upper limit on list of clients */ 41 const ADMIN_CLIENT_LIST_MAX = 16384; 42 43 /* Upper limit on number of client info parameters */ 44 const ADMIN_CLIENT_INFO_PARAMETERS_MAX = 64; 45 46 /* Upper limit on number of client processing controls */ 47 const ADMIN_SERVER_CLIENT_LIMITS_MAX = 32; 48 49 /* A long string, which may NOT be NULL. */ 50 typedef string admin_nonnull_string<ADMIN_STRING_MAX>; 51 52 /* A long string, which may be NULL. */ 53 typedef admin_nonnull_string *admin_string; 54 55 union admin_typed_param_value switch (int type) { 56 case VIR_TYPED_PARAM_INT: 57 int i; 58 case VIR_TYPED_PARAM_UINT: 59 unsigned int ui; 60 case VIR_TYPED_PARAM_LLONG: 61 hyper l; 62 case VIR_TYPED_PARAM_ULLONG: 63 unsigned hyper ul; 64 case VIR_TYPED_PARAM_DOUBLE: 65 double d; 66 case VIR_TYPED_PARAM_BOOLEAN: 67 int b; 68 case VIR_TYPED_PARAM_STRING: 69 admin_nonnull_string s; 70 }; 71 72 struct admin_typed_param { 73 admin_nonnull_string field; 74 admin_typed_param_value value; 75 }; 76 77 /* A server which may NOT be NULL */ 78 struct admin_nonnull_server { 79 admin_nonnull_string name; 80 }; 81 82 /* A client which may NOT be NULL */ 83 struct admin_nonnull_client { 84 admin_nonnull_server srv; 85 unsigned hyper id; 86 hyper timestamp; 87 unsigned int transport; 88 }; 89 90 /*----- Protocol. -----*/ 91 92 struct admin_connect_open_args { 93 unsigned int flags; 94 }; 95 96 struct admin_connect_get_lib_version_ret { 97 unsigned hyper libVer; 98 }; 99 100 struct admin_connect_list_servers_args { 101 unsigned int need_results; 102 unsigned int flags; 103 }; 104 105 struct admin_connect_list_servers_ret { /* insert@1 */ 106 admin_nonnull_server servers<ADMIN_SERVER_LIST_MAX>; 107 unsigned int ret; 108 }; 109 110 struct admin_connect_lookup_server_args { 111 admin_nonnull_string name; 112 unsigned int flags; 113 }; 114 115 struct admin_connect_lookup_server_ret { 116 admin_nonnull_server srv; 117 }; 118 119 struct admin_server_get_threadpool_parameters_args { 120 admin_nonnull_server srv; 121 unsigned int flags; 122 }; 123 124 struct admin_server_get_threadpool_parameters_ret { 125 admin_typed_param params<ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX>; 126 }; 127 128 struct admin_server_set_threadpool_parameters_args { 129 admin_nonnull_server srv; 130 admin_typed_param params<ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX>; 131 unsigned int flags; 132 }; 133 134 struct admin_server_list_clients_args { 135 admin_nonnull_server srv; 136 unsigned int need_results; 137 unsigned int flags; 138 }; 139 140 struct admin_server_list_clients_ret { /* insert@1 */ 141 admin_nonnull_client clients<ADMIN_CLIENT_LIST_MAX>; 142 unsigned int ret; 143 }; 144 145 struct admin_server_lookup_client_args { 146 admin_nonnull_server srv; 147 unsigned hyper id; 148 unsigned int flags; 149 }; 150 151 struct admin_server_lookup_client_ret { 152 admin_nonnull_client clnt; 153 }; 154 155 struct admin_client_get_info_args { 156 admin_nonnull_client clnt; 157 unsigned int flags; 158 }; 159 160 struct admin_client_get_info_ret { /* insert@1 */ 161 admin_typed_param params<ADMIN_CLIENT_INFO_PARAMETERS_MAX>; 162 }; 163 164 struct admin_client_close_args { 165 admin_nonnull_client clnt; 166 unsigned int flags; 167 }; 168 169 struct admin_server_get_client_limits_args { 170 admin_nonnull_server srv; 171 unsigned int flags; 172 }; 173 174 struct admin_server_get_client_limits_ret { 175 admin_typed_param params<ADMIN_SERVER_CLIENT_LIMITS_MAX>; 176 }; 177 178 struct admin_server_set_client_limits_args { 179 admin_nonnull_server srv; 180 admin_typed_param params<ADMIN_SERVER_CLIENT_LIMITS_MAX>; 181 unsigned int flags; 182 }; 183 184 struct admin_server_update_tls_files_args { 185 admin_nonnull_server srv; 186 unsigned int flags; 187 }; 188 189 struct admin_connect_get_logging_outputs_args { 190 unsigned int flags; 191 }; 192 193 struct admin_connect_get_logging_outputs_ret { 194 admin_nonnull_string outputs; 195 unsigned int noutputs; 196 }; 197 198 struct admin_connect_get_logging_filters_args { 199 unsigned int flags; 200 }; 201 202 struct admin_connect_get_logging_filters_ret { 203 admin_string filters; 204 unsigned int nfilters; 205 }; 206 207 struct admin_connect_set_logging_outputs_args { 208 admin_string outputs; 209 unsigned int flags; 210 }; 211 212 struct admin_connect_set_logging_filters_args { 213 admin_string filters; 214 unsigned int flags; 215 }; 216 217 /* Define the program number, protocol version and procedure numbers here. */ 218 const ADMIN_PROGRAM = 0x06900690; 219 const ADMIN_PROTOCOL_VERSION = 1; 220 221 enum admin_procedure { 222 /* Each function must be preceded by a comment providing one or 223 * more annotations: 224 * 225 * - @generate: none|client|server|both 226 * 227 * Whether to generate the dispatch stubs for the server 228 * and/or client code. 229 * 230 * - @readstream: paramnumber 231 * - @writestream: paramnumber 232 * 233 * The @readstream or @writestream annotations let daemon and src/remote 234 * create a stream. The direction is defined from the src/remote point 235 * of view. A readstream transfers data from daemon to src/remote. The 236 * <paramnumber> specifies at which offset the stream parameter is inserted 237 * in the function parameter list. 238 */ 239 /** 240 * @generate: none 241 */ 242 ADMIN_PROC_CONNECT_OPEN = 1, 243 244 /** 245 * @generate: none 246 */ 247 ADMIN_PROC_CONNECT_CLOSE = 2, 248 249 /** 250 * @generate: both 251 */ 252 ADMIN_PROC_CONNECT_GET_LIB_VERSION = 3, 253 254 /** 255 * @generate: both 256 */ 257 ADMIN_PROC_CONNECT_LIST_SERVERS = 4, 258 259 /** 260 * @generate: both 261 */ 262 ADMIN_PROC_CONNECT_LOOKUP_SERVER = 5, 263 264 /** 265 * @generate: none 266 */ 267 ADMIN_PROC_SERVER_GET_THREADPOOL_PARAMETERS = 6, 268 269 /** 270 * @generate: none 271 */ 272 ADMIN_PROC_SERVER_SET_THREADPOOL_PARAMETERS = 7, 273 274 /** 275 * @generate: both 276 */ 277 ADMIN_PROC_SERVER_LIST_CLIENTS = 8, 278 279 /** 280 * @generate: both 281 */ 282 ADMIN_PROC_SERVER_LOOKUP_CLIENT = 9, 283 284 /** 285 * @generate: none 286 */ 287 ADMIN_PROC_CLIENT_GET_INFO = 10, 288 289 /** 290 * @generate: both 291 */ 292 ADMIN_PROC_CLIENT_CLOSE = 11, 293 294 /** 295 * @generate: none 296 */ 297 ADMIN_PROC_SERVER_GET_CLIENT_LIMITS = 12, 298 299 /** 300 * @generate: none 301 */ 302 ADMIN_PROC_SERVER_SET_CLIENT_LIMITS = 13, 303 304 /** 305 * @generate: none 306 */ 307 ADMIN_PROC_CONNECT_GET_LOGGING_OUTPUTS = 14, 308 309 /** 310 * @generate: none 311 */ 312 ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15, 313 314 /** 315 * @generate: both 316 */ 317 ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16, 318 319 /** 320 * @generate: both 321 */ 322 ADMIN_PROC_CONNECT_SET_LOGGING_FILTERS = 17, 323 324 /** 325 * @generate: both 326 */ 327 ADMIN_PROC_SERVER_UPDATE_TLS_FILES = 18 328 }; 329