/* A simple standalone XML-RPC server written in C. */ #include #include #include #include #include struct hd { khep_hand_t fd; }; struct hd handles[1]; #include "functions.h" static xmlrpc_value * rpc_khep_open (xmlrpc_env *env, xmlrpc_value *param_array, void *user_data) { xmlrpc_int32 res = 0; return xmlrpc_build_value(env, "i", res); } int main (int argc, char **argv) { if (argc != 2) { fprintf(stderr, "Usage: servertest abyss.conf\n"); exit(1); } xmlrpc_server_abyss_init(XMLRPC_SERVER_ABYSS_NO_FLAGS, argv[1]); handles[0].fd = khep_open("/dev/rfcomm0", KHEP_B115200); xmlrpc_server_abyss_add_method("open", &rpc_khep_open, NULL); xmlrpc_server_abyss_add_method("cmd_setled", &rpc_khep_cmd_setled, NULL); printf("server: switching to background.\n"); xmlrpc_server_abyss_run(); /* We never reach this point. */ return 0; }