1 /*
2  * Copyright (C) 2002-2003 Fhg Fokus
3  *
4  * This file is part of SEMS, a free SIP media server.
5  *
6  * SEMS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version. This program is released under
10  * the GPL with the additional exemption that compiling, linking,
11  * and/or using OpenSSL is allowed.
12  *
13  * For a license to use the SEMS software under conditions
14  * other than those described here, or to purchase support for this
15  * software, please contact iptel.org by e-mail at the following addresses:
16  *    info@iptel.org
17  *
18  * SEMS is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26  */
27 /** @file AmSipEvent.h */
28 #ifndef AmSipEvent_h
29 #define AmSipEvent_h
30 
31 #include "AmEvent.h"
32 #include "AmSipMsg.h"
33 
34 class AmBasicSipDialog;
35 
36 /** \brief base class for SIP events */
37 class AmSipEvent: public AmEvent
38 {
39  public:
AmSipEvent()40   AmSipEvent()
41     : AmEvent(-1)
42     {}
43 
AmSipEvent(const AmSipEvent & ev)44   AmSipEvent(const AmSipEvent& ev)
45     : AmEvent(ev)
46     {}
47 
48   virtual void operator() (AmBasicSipDialog* dlg)=0;
49 };
50 
51 /** \brief UAS reply re-transmission timeout event */
52 class AmSipTimeoutEvent: public AmSipEvent
53 {
54  public:
55 
56   enum EvType {
57     _noEv=0,
58     noACK,
59     noPRACK,
60   };
61 
62   EvType       type;
63 
64   unsigned int cseq;
65   AmSipRequest req;
66   AmSipReply   rpl;
67 
AmSipTimeoutEvent(EvType t,unsigned int cseq_num)68   AmSipTimeoutEvent(EvType t, unsigned int cseq_num)
69     : AmSipEvent(), type(t), cseq(cseq_num)
70    {}
AmSipTimeoutEvent(EvType t,AmSipRequest & _req,AmSipReply & _rpl)71   AmSipTimeoutEvent(EvType t, AmSipRequest &_req, AmSipReply &_rpl)
72     : AmSipEvent(), type(t), cseq(_req.cseq), req(_req), rpl(_rpl)
73     {}
74 
75   virtual void operator() (AmBasicSipDialog* dlg);
76 };
77 
78 /** \brief SIP request event */
79 class AmSipRequestEvent: public AmSipEvent
80 {
81  public:
82   AmSipRequest req;
83 
AmSipRequestEvent(const AmSipRequest & r)84   AmSipRequestEvent(const AmSipRequest& r)
85     : AmSipEvent(), req(r)
86     {}
87 
88   virtual void operator() (AmBasicSipDialog* dlg);
89 };
90 
91 /** \brief SIP reply event */
92 class AmSipReplyEvent: public AmSipEvent
93 {
94  public:
95   AmSipReply reply;
96 
AmSipReplyEvent(const AmSipReply & r)97   AmSipReplyEvent(const AmSipReply& r)
98     : AmSipEvent(),reply(r) {}
99 
100   virtual void operator() (AmBasicSipDialog* dlg);
101 };
102 
103 
104 
105 #endif
106