/* vccd/include/vcc/vcc.h * * This file is part of vccd. * * vccd 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. * * vccd 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 vccd. If not, see */ #ifndef __VCC_VCC_H #define __VCC_VCC_H /* magic number in vcc_request to check that it's really a vcc package */ #define VCC_MAGIC 0x01328e22 /* the port that vccd is listening on */ #define VCC_PORT 46 /* client -> server, send a message */ #define REQ_MSG_SEND 1 /* server -> client. sent when received a message */ #define REQ_MSG_NEW 2 /* client -> server. get users logged-in */ #define REQ_CTL_USRS 3 /* client -> server. login with password and username. * server -> client. login ack */ #define REQ_CTL_LOGIN 4 #define REQ_SIZE 1024 #define USRNAME_SIZE 32 #define MSG_SIZE (REQ_SIZE - 3 * sizeof(int) - USRNAME_SIZE) struct vcc_request { int magic; int reqtype; /* to make server easy and fast */ int uid; char usrname[USRNAME_SIZE]; char msg[MSG_SIZE]; }; #define to_boolean(c) (!!(c)) #define likely(c) __builtin_expect(to_boolean(c), 1) #define unlikely(c) __builtin_expect(to_boolean(c), 0) #endif