/* whenjobs -*- c -*- * (C) Copyright 2012 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This is the protocol used to talk between the client (whenjobs) and * the daemon (whenjobsd). Communication happens over a Unix domain * socket '$HOME/.whenjobs/socket'. The wire protocol is SunRPC. */ /* Maximum length of a variable name and string value. */ const MAX_VARIABLE_NAME_LENGTH = 256; const MAX_VARIABLE_VALUE_LENGTH = 65536; typedef string variable_name; typedef string string_value; typedef variable_name variable_name_list<>; /* Status code (OK or error) returned by most calls. */ enum status_code { OK = 1, ERROR = 2 }; union status switch (status_code s) { case OK: void; case ERROR: string error<>; }; enum variable_type { BOOL_T = 0, STRING_T = 1, INT_T = 2, FLOAT_T = 3 }; union variable switch (variable_type t) { case BOOL_T: bool b; case STRING_T: string_value s; case INT_T: string i<64>; /* OCaml [big_int], as a string. */ case FLOAT_T: double f; /* C 'double' maps to an OCaml 'float' */ }; /* The API of the daemon. */ program When { version V1 { status reload_file (void) = 1; status set_variable (variable_name, variable) = 2; variable get_variable (variable_name) = 3; variable_name_list get_variable_names (void) = 4; status exit_daemon (void) = 5; } = 1; } = 0x20008081;