| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /* 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 <https://www.gnu.org/licenses/>
- */
- #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
- #define VCC_MAGIC_CR 0x01328e36
- /* 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
- /* client -> server. create a new session */
- #define REQ_CTL_NEWSE 5
- /* client -> server: request (get sessions present).
- * server -> client: response */
- #define REQ_CTL_SESS 6
- /* client -> server. join session */
- #define REQ_CTL_JOINS 7
- /* client -> server. get user info */
- #define REQ_CTL_UINFO 8
- /* client -> server. increase one's score */
- #define REQ_SYS_SCRINC 9
- #define REQ_SIZE 512
- #define USRNAME_SIZE 32
- /* we'll not warn you anyway. */
- #define PASSWD_SIZE 64
- #define MSG_SIZE (REQ_SIZE - 5 * sizeof(int) - USRNAME_SIZE)
- #define FLAG_ENCRYPTED 1
- struct vcc_request {
- int magic;
- int reqtype;
- /* to make server easy and fast */
- int uid;
- int session;
- int flags;
- 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
|