1 /* 2 * imc module - instant messaging conferencing implementation 3 * 4 * Copyright (C) 2006 Voice Sistem S.R.L. 5 * 6 * This file is part of Kamailio, a free SIP server. 7 * 8 * Kamailio is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version 12 * 13 * Kamailio is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 */ 23 24 25 26 27 #ifndef _IMC_CMD_H_ 28 #define _IMC_CMD_H_ 29 30 #include "../../core/parser/parse_uri.h" 31 #include "../../core/str.h" 32 #include "imc_mng.h" 33 #include "imc.h" 34 35 #define IMC_CMD_START '#' 36 #define IMC_CMD_START_STR "#" 37 38 #define IMC_CMDID_CREATE 1 39 #define IMC_CMDID_INVITE 2 40 #define IMC_CMDID_JOIN 3 41 #define IMC_CMDID_LEAVE 4 42 #define IMC_CMDID_ACCEPT 5 43 #define IMC_CMDID_REJECT 6 44 #define IMC_CMDID_REMOVE 7 45 #define IMC_CMDID_DESTROY 8 46 #define IMC_CMDID_HELP 9 47 #define IMC_CMDID_MEMBERS 10 48 #define IMC_CMDID_UNKNOWN 11 49 #define IMC_CMDID_ADD 12 50 #define IMC_CMDID_ROOMS 13 51 52 53 #define IMC_CMD_CREATE "create" 54 #define IMC_CMD_INVITE "invite" 55 #define IMC_CMD_JOIN "join" 56 #define IMC_CMD_LEAVE "leave" 57 #define IMC_CMD_ACCEPT "accept" 58 #define IMC_CMD_REJECT "reject" 59 #define IMC_CMD_REMOVE "remove" 60 #define IMC_CMD_DESTROY "destroy" 61 #define IMC_CMD_MEMBERS "members" 62 #define IMC_CMD_ADD "add" 63 #define IMC_CMD_ROOMS "rooms" 64 65 #define IMC_ROOM_PRIVATE "private" 66 #define IMC_ROOM_PRIVATE_LEN (sizeof(IMC_ROOM_PRIVATE)-1) 67 68 #define IMC_HELP_MSG "\r\n"IMC_CMD_START_STR IMC_CMD_CREATE" <room_name> - \ 69 create new conference room\r\n\ 70 "IMC_CMD_START_STR IMC_CMD_JOIN" [<room_name>] - \ 71 join the conference room\r\n\ 72 "IMC_CMD_START_STR IMC_CMD_INVITE" <user_name> [<room_name>] - \ 73 invite a user to join a conference room\r\n\ 74 "IMC_CMD_START_STR IMC_CMD_ADD" <user_name> [<room_name>] - \ 75 add a user to a conference room\r\n\ 76 "IMC_CMD_START_STR IMC_CMD_ACCEPT" - \ 77 accept invitation to join a conference room\r\n\ 78 "IMC_CMD_START_STR IMC_CMD_REJECT" - \ 79 reject invitation to join a conference room\r\n\ 80 "IMC_CMD_START_STR IMC_CMD_REMOVE" <user_name> [<room_name>] - \ 81 remove an user from the conference room\r\n\ 82 "IMC_CMD_START_STR IMC_CMD_MEMBERS" - \ 83 list members is a conference room\r\n\ 84 "IMC_CMD_START_STR IMC_CMD_ROOMS" - \ 85 list existing conference rooms\r\n\ 86 "IMC_CMD_START_STR IMC_CMD_LEAVE" [<room_name>] - \ 87 leave from a conference room\r\n\ 88 "IMC_CMD_START_STR IMC_CMD_DESTROY" [<room_name>] - \ 89 destroy conference room\r\n" 90 91 #define IMC_HELP_MSG_LEN (sizeof(IMC_HELP_MSG)-1) 92 93 94 #define IMC_CMD_MAX_PARAM 5 95 typedef struct _imc_cmd 96 { 97 str name; 98 int type; 99 str param[IMC_CMD_MAX_PARAM]; 100 } imc_cmd_t, *imc_cmd_p; 101 102 int imc_parse_cmd(char *buf, int len, imc_cmd_p cmd); 103 104 int imc_handle_create(struct sip_msg* msg, imc_cmd_t *cmd, 105 struct imc_uri *src, struct imc_uri *dst); 106 int imc_handle_join(struct sip_msg* msg, imc_cmd_t *cmd, 107 struct imc_uri *src, struct imc_uri *dst); 108 int imc_handle_invite(struct sip_msg* msg, imc_cmd_t *cmd, 109 struct imc_uri *src, struct imc_uri *dst); 110 int imc_handle_add(struct sip_msg* msg, imc_cmd_t *cmd, 111 struct imc_uri *src, struct imc_uri *dst); 112 int imc_handle_accept(struct sip_msg* msg, imc_cmd_t *cmd, 113 struct imc_uri *src, struct imc_uri *dst); 114 int imc_handle_reject(struct sip_msg* msg, imc_cmd_t *cmd, 115 struct imc_uri *src, struct imc_uri *dst); 116 int imc_handle_remove(struct sip_msg* msg, imc_cmd_t *cmd, 117 struct imc_uri *src, struct imc_uri *dst); 118 int imc_handle_members(struct sip_msg* msg, imc_cmd_t *cmd, 119 struct imc_uri *src, struct imc_uri *dst); 120 int imc_handle_rooms(struct sip_msg* msg, imc_cmd_t *cmd, 121 struct imc_uri *src, struct imc_uri *dst); 122 int imc_handle_leave(struct sip_msg* msg, imc_cmd_t *cmd, 123 struct imc_uri *src, struct imc_uri *dst); 124 int imc_handle_destroy(struct sip_msg* msg, imc_cmd_t *cmd, 125 struct imc_uri *src, struct imc_uri *dst); 126 int imc_handle_unknown(struct sip_msg* msg, imc_cmd_t *cmd, 127 struct imc_uri *src, struct imc_uri *dst); 128 int imc_handle_help(struct sip_msg* msg, imc_cmd_t *cmd, 129 struct imc_uri *src, struct imc_uri *dst); 130 int imc_handle_message(struct sip_msg* msg, str *msgbody, 131 struct imc_uri *src, struct imc_uri *dst); 132 133 #endif 134