diff options
| author | Franklin Wei <git@fwei.tk> | 2016-01-15 17:25:16 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2016-01-15 17:25:16 -0500 |
| commit | b8a5c11cbd8a0514754558892d9bbd620345799c (patch) | |
| tree | 5687d0e98212c7067c5049bd3914045595c75d21 /src/client.h | |
| parent | abe9f416501c5354be3ce292b4220000edf021ab (diff) | |
| download | netcosm-b8a5c11cbd8a0514754558892d9bbd620345799c.zip netcosm-b8a5c11cbd8a0514754558892d9bbd620345799c.tar.gz netcosm-b8a5c11cbd8a0514754558892d9bbd620345799c.tar.bz2 netcosm-b8a5c11cbd8a0514754558892d9bbd620345799c.tar.xz | |
refactor headers
Diffstat (limited to 'src/client.h')
| -rw-r--r-- | src/client.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h new file mode 100644 index 0000000..be75c03 --- /dev/null +++ b/src/client.h @@ -0,0 +1,45 @@ +/* + * NetCosm - a MUD server + * Copyright (C) 2016 Franklin Wei + * + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/* You should use #pragma once everywhere. */ +#pragma once + +#include "room.h" +#include "userdb.h" + +enum reqdata_typespec { TYPE_NONE = 0, TYPE_USERDATA, TYPE_BOOLEAN } reqdata_type; + +union reqdata_t { + struct userdata_t userdata; + bool boolean; +}; + +extern enum reqdata_typespec reqdata_type; +extern union reqdata_t returned_reqdata; + +/* call from child process ONLY */ +void send_master(unsigned char cmd, const void *data, size_t sz); + +/* the master sends the child SIGRTMIN+0 */ +void sig_rt_0_handler(int s, siginfo_t *info, void *v); + +void out(const char *fmt, ...) __attribute__((format(printf,1,2))); +void out_raw(const unsigned char*, size_t); + +/* called for every client */ +void client_main(int sock, struct sockaddr_in *addr, int, int to_parent, int from_parent); |