1: /*
2: * Guitar-ZyX(tm)::MasterControlProgram - portable guitar F/X controller
3: * Copyright (C) 2009 Douglas McClendon
4: *
5: * This program is free software: you can redistribute it and/or modify
6: * it under the terms of the GNU General Public License as published by
7: * the Free Software Foundation, version 3 of the License.
8: *
9: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program. If not, see <http://www.gnu.org/licenses/>.
16: */
17: /*
18: #
19: #############################################################################
20: #############################################################################
21: ##
22: ## gzmcp: daemon
23: ##
24: #############################################################################
25: ##
26: ## Copyright 2007-2009 Douglas McClendon <dmc AT filteredperception DOT org>
27: ##
28: #############################################################################
29: #############################################################################
30: #
31: */
32:
33:
34:
35:
36: #define GZMCP_BEACON_PERIOD_USEC 7777777
37:
38: #define CMD_BUF_SIZE 16
39:
40: #define PATH_MAXLEN 1023
41: #define STATUS_MSG_MAXLEN 1023
42:
43: #define UPD_WR_BUF_SZ 8192
44:
45: #define UPDATE_FILENAME "gzmcp-update.nds"
46: #define VARLIBDIR "/var/lib/gzmcp"
47:
48: #if defined MORE_DEBUG
49: #define debug_more(args...) status(args)
50: #else
51: #define debug_more(args...)
52: #endif
53:
54:
55:
56:
57: #include "gzmcp_protocol.h"
58:
59:
60:
61:
62:
63:
64:
65: void usage(void);
66:
67: long ec_strtol(char *str);
68:
69:
70: void basename(char *dest, char *path);
71:
72: void dirname(char *dest, char *path);
73:
74:
75: void status(const char *msg_fmt, ...);
76:
77: void die(const char *msg_fmt, ...);
78:
79:
80: void midi_init(void);
81:
82: void midi_shutdown(void);
83:
84:
85: void network_init(void);
86:
87: void broadcast(void);
88:
89: void network_shutdown(void);
90:
91: int wait_for_connection(void);
92:
93: void handle_cmd_handshake(int client_socket_fd,
94: gzmcp_cmd cmd);
95: void handle_cmd_getupdate(int client_socket_fd);
96:
97: void connection_handler(int client_socket_fd);
98:
99: void get_and_handle_a_connection(void);
100:
101: void configure_reaper(void);
102:
103: void offspring_reaper(void);
104: