X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fwhenproto.x;fp=lib%2Fwhenproto.x;h=faa120dacc93c87950528a1dc1766a0fa72a0f5c;hb=61cad7bbaf63389b520b695eefdd735bc11a8aa6;hp=0000000000000000000000000000000000000000;hpb=21298f7a45ee536800be5e771438b01089a5cb2c;p=whenjobs.git diff --git a/lib/whenproto.x b/lib/whenproto.x new file mode 100644 index 0000000..faa120d --- /dev/null +++ b/lib/whenproto.x @@ -0,0 +1,72 @@ +/* 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; + void set_variable (variable_name, variable) = 2; + variable get_variable (variable_name) = 3; + variable_name_list get_variable_names (void) = 4; + } = 1; +} = 0x20008081;