/* Copyright (C) 2002 GFRN systems This program 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 2 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The latest version of this program may be found at http://CQiNet.sourceforge.net $Log: conference.h,v $ Revision 1.13 2007/06/27 19:43:41 wb6ymh 1. Added variables, externs, and prototypes needed for the upcoming thelinkbox project. 2. Removed pCmdLine and Err members from ConfServer structure. 3. Moved PacketType enum here from conference.c. 4. Modified CreateConference prototype to return an error code and add a new argument pointing to created conference on success. Revision 1.12 2004/11/29 00:36:41 wb6ymh Added SendAvrsUpdate prototype. Include avrs.h for AVRS_State. Revision 1.11 2004/11/27 22:14:24 wb6ymh Added ConferenceClients. Revision 1.10 2004/11/22 01:01:52 wb6ymh Removed ClientIPAdrUpdate ... bad bad buggy code. Revision 1.9 2004/05/29 17:19:35 wb6ymh 1. Include "users.h" if it has not already been included. 2. Added prototype for ClientIPAdrUpdate(); Revision 1.8 2003/09/09 21:02:08 wb6ymh Added bMuteTBD member to ConfServer. Revision 1.7 2003/09/07 15:16:47 wb6ymh 1. Added DupsReceived, DupDisconnects, bPlayWhenIdle, bPlayWhenFree, bMuteConf, bMuteUsers, bMuteRF, and pCmdLine members to ConfServer. 2. Added ssrc, DupsReceived, pCS, bCmdLine, bFilePlayer, and bTxtExtension members to ConfClient. 3. Added prototypes for CmdLine_Handler, GenSDES, StartCmdHandler. Revision 1.6 2003/04/30 21:32:59 wb6ymh Added bAutoLurk, bTimedOut, bMonitor, bLink, and bRepeater to ConfClient. Revision 1.5 2002/12/21 18:49:00 wb6ymh 1. Added bSentQuotedCmd, bSentInfo to ConfClient. 2. Added Filename, FirstTimeStamp, LastTimeStamp, bTooSlowLogged and bDeleteOnClose to ClientFileIO. Revision 1.4 2002/11/02 18:42:04 wb6ymh 1. Moved EventType, ConfServer, ConfClient and ClientFileIO here from conference.c 2. Added Protocol enum. 3. Added prototypes for CreateConference(), GenSDES(), and SFConfInit(). Revision 1.3 2002/09/14 16:43:45 wb6ymh Added prototype for GetUserCountString. Revision 1.2 2002/08/31 23:56:47 wb6ymh Added prototypes for LoadBannedList() and LoadBulletinList(). Revision 1.1.1.1 2002/08/10 20:33:41 wb6ymh initial import */ #ifndef CONFERENCE_H_ #define CONFERENCE_H_ #ifndef USERS_H_ #include "users.h" #endif #ifndef _AVRS_H_ #include "avrs.h" #endif #ifdef LINK_BOX #include "gsm.h" #include "rtp.h" #endif #define CONF_BUF_SIZE 1024 typedef enum { EVENT_INIT = 1, EVENT_RTP_RX, EVENT_RTP_TO, EVENT_RTCP_RX, EVENT_RTCP_TO, EVENT_DELETE, } EventType; typedef enum { // NB: Protocols must be the RTCP version minus one PROTO_SF, PROTO_RTP, PROTO_ILINK, } Protocol; #define NUM_PROTOCOLS 3 #ifdef LINK_BOX // variables needed for client endpoint typedef struct RtpDataTAG { struct RtpDataTAG *Link; // NB: must be first rtp_hdr_t *pData; int Len; // length of packet } RtpData; typedef struct NetAudioTAG { struct NetAudioTAG *Link; // NB: must be first int Available; // bytes of available data (samples *2) int Used; // bytes of data used char Buf[1]; // actual length varies } NetAudio; typedef struct PCMAudioTAG { struct PCMAudioTAG *Link; // NB: must be first } PCMAudio; #endif typedef struct ConfServer_TAG { FILE *fp; struct avl_table *ConfTree; // sorted by IP address ClientInfo *pAudio; ClientInfo *pControl; time_t TimeNextSDES; struct timeval LastAudioIn; struct timeval *pLastAudioIn; struct ConfClient_TAG *pFilePlayer; // All time totals u_int TxMBytes; u_int TxBytes; u_int TxCount; // packet count u_int RxBytes; u_int RxMBytes; u_int RxCount; // packet count u_int PeakTxBandWidth; time_t PeakTxBandWidthTime; u_int PeakRxBandWidth; time_t PeakRxBandWidthTime; struct timeval StartTime; u_int TxBytesStart; u_int RxBytesStart; u_int RxErrs; u_int TxErrs; // Last measurement u_int TxBandWidth; // 1000 bits per second u_int RxBandWidth; int AudioPort; int ControlPort; int DupsReceived; int DupDisconnects; int bRecording:1; int bLinkedConfs:1; int bSendStationList:1; int biLinkConf:1; int bSFConf:1; int bPlayWhenIdle:1; int bPlayWhenFree:1; int bMuteConf:1; int bMuteUsers:1; int bMuteRF:1; int bMuteTBD:1; #ifdef LINK_BOX // variables needed for client endpoint int bRxActive:1; #endif } ConfServer; typedef struct ConfClient_TAG { struct ConfClient_TAG *Link; // NB: must be the first member IPAdrUnion HisAdr; int SN; int (*State)(ClientInfo *p,struct ConfClient_TAG *pCC,EventType Event); time_t LoginTime; time_t LastHeard; char *CallPlus; char *Callsign; char *Password; // Used for RTP & Speak Freely only char *Info; struct timeval FirstAudioIn; struct timeval LastAudioIn; u_int TxBytes; u_int RxBytes; int ssrc; int DupsReceived; ConfServer *pCS; void *p; // various uses Protocol Proto; u_int8 CompressionType; int bInConf:1; int bLurking:1; int bTalking:1; // This client has the conference's "talk" token int bAdmin:1; int bSysop:1; int bDoublingWarningSent:1; int bPauseWarningSent:1; int bSWL:1; // ignore all received data, including text, commands int bMuted:1; int bKicked:1; int bPermanent:1; int bConf:1; int bTBD:1; int bSendSSRC:1; int bFileIOActive:1; int bFirstAudio:1; int bNoChat:1; int bBelcher:1; int bSentQuotedCmd:1; int bSentInfo:1; int bAutoLurk:1; int bTimedOut:1; int bMonitor:1; int bLink:1; int bRepeater:1; int bCmdLine:1; int bFilePlayer:1; int bTxtExtension:1; int bWelcomePending:1; #ifdef LINK_BOX // variables needed for client endpoint int bRfUser:1; int MissedPackets; int OutofSeqPackets; int DuplicatePackets; int LatePackets; // sequence number of next packet that will be converted to audio when needed u_int16 NextSeq; // Queue of audio packets NetAudio *pInHead; NetAudio *pInTail; int AudioQCount; RtpData *pRtpQueue; int RtpQCount; gsm gsmh; // receive state transisions: // idle -> buffering -> active -> idle // ^ | // +------------+ // int bRxIdle:1; int bRxBuffering:1; int bRxActive:1; #endif } ConfClient; // Variables used while recording or playing back files typedef struct { ConfClient *pCC; ClientInfo *pClient; FILE *fp; char *Filename; struct timeval TimeFirstTx; struct timeval TimeLastTx; int Timeout; int x; time_t FirstTimeStamp; time_t LastTimeStamp; int bTooSlowLogged:1; int bDeleteOnClose:1; } ClientFileIO; extern int ConferenceClients; typedef enum { PKT_TYPE_UNKNOWN, PKT_TYPE_AUDIO, PKT_TYPE_DATA, PKT_TYPE_CMD, PKT_TYPE_IGNORE, PKT_TYPE_UNSUPPORTED } PacketType; extern ConfClient *ClientTalking; extern ConfServer *piLinkConf; extern ConfServer *pSFConf; extern char *StationDisconnected; extern int Rcode; extern int LastRcode; extern char *LastCmdText; extern char *LastCmd; int ConferenceInit(void); int SFConfInit(void); int RTP_Handler(ClientInfo *pRTP); int RTCP_Handler(ClientInfo *p); void LoadBannedList(); void LoadBulletinList(); char *GetUserCountString(); int CreateConference(int AudioPort,int ControlPort,ConfServer *pMainConf, ConfServer **pRet); int CmdLine_Handler(ClientInfo *p); void GenSDES(int rtp_version,int bTxtExtension); void StartCmdHandler(char *Cmd); void SendAvrsUpdate(AVRS_State State,char *Callsign); PacketType GetPacketType(ClientInfo *p,ConfClient *pCC); int TimeLapse(struct timeval *p); void Send2(ClientInfo *p,ConfClient *pCC,void *Data,int Count,int Port); void ConferenceCmd(ClientInfo *p,ConfClient *pCC,char *cmd); #endif