/* vcc/vcc.c * * This file is part of vcc. * * vcc 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. * * vcc 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 vcc. If not, see */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern int fd; int send_msg(const char *msg, const char *usrname) { struct vcc_request req; req.magic = htonl(VCC_MAGIC); req.reqtype = htonl(REQ_MSG_SEND); req.uid = 0; strcpy(req.usrname, usrname); strcpy(req.msg, msg); write(fd, &req, REQ_SIZE); return 0; } int read_msg(struct vcc_request *buf) { return read(fd, buf, REQ_SIZE); }