interfaces.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* vcc/include/vcc/interfaces.h
  2. *
  3. * This file is part of vcc.
  4. *
  5. * vcc 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, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * vcc is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with vcc. If not, see <https://www.gnu.org/licenses/>
  17. */
  18. #ifndef __VCC_INTERFACES_H
  19. #define __VCC_INTERFACES_H
  20. #include <sys/types.h>
  21. #include <vcc/vcc.h>
  22. #include <klist.h>
  23. struct banlist {
  24. char *usrname;
  25. struct klist_node node;
  26. };
  27. #define banlist_of(n) container_of(n, struct banlist, node)
  28. struct history {
  29. char *usrname;
  30. char *msg;
  31. struct klist_node node;
  32. };
  33. #define hist_of(n) container_of(n, struct history, node)
  34. int vcc_login(char *, char *);
  35. int do_intiauth(void);
  36. int send_msg(const char *msg, const char *usrname);
  37. int send_msg_encrypted(const char *msg, const char *s);
  38. int send_relay_msg(const char *, const char *, const char *);
  39. int read_msg(struct vcc_request *buf);
  40. char *relay_get_msg(int fd, struct vcc_relay_header *);
  41. int is_user_banned(char *);
  42. int pretty_init(void);
  43. int show_algo_info(void);
  44. int crypt_init(void *key, void *iv);
  45. int encrypt(char *);
  46. int decrypt(char *);
  47. int do_cmd(char *s);
  48. int do_bh(struct vcc_request *);
  49. int do_relay_bh(struct vcc_relay_header *);
  50. int do_cmd_lself(int, char **);
  51. int init_socket(const char *server_addr, int server_port);
  52. int handle_command(char *);
  53. int do_handle_command(char *);
  54. int get_user_info(char *usrname);
  55. int get_users(void);
  56. int incr_score(char *username, int incr);
  57. int vcc_create_session(char *name);
  58. int get_sessions(void);
  59. int join_session(int sid);
  60. int get_sys_info(void);
  61. int session_name(int, char *);
  62. int robot_new_msg(struct vcc_request *);
  63. int vcc_login_bh(struct vcc_request *);
  64. int sename_bh(struct vcc_request *);
  65. int do_cmd_ls_bh(struct vcc_relay_header *);
  66. int do_cmd_lsse_bh(struct vcc_request *);
  67. int do_cmd_uinfo_bh(struct vcc_request *);
  68. int do_cmd_incr_bh(struct vcc_request *);
  69. struct history *hist_getmsg(int last);
  70. extern int fd;
  71. extern struct klist_node banned_people;
  72. extern char usrname[];
  73. extern int rate;
  74. extern int current_sid;
  75. extern int self_level;
  76. extern int crypt_disabled;
  77. #endif