# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY 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.
#
# For a license to use the SIPPY software under conditions
# other than those described here, or to purchase support for this
# software, please contact Sippy Software, Inc. by e-mail at the
# following addresses: sales@sippysoft.com.
#
# SIPPY 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.
#
# $Id: CCEvents.py,v 1.4 2009/01/05 20:14:00 sobomax Exp $

from time import time

class CCEventGeneric(object):
    data = None
    name = None
    rtime = None

    def __init__(self, data = None, rtime = None):
        self.data = data
        if rtime == None:
            self.rtime = time()
        else:
            self.rtime = rtime

    def getData(self):
        return self.data

    def __str__(self):
        return self.name

class CCEventTry(CCEventGeneric):
    name = 'CCEventTry'
    pass

class CCEventRing(CCEventGeneric):
    name = 'CCEventRing'
    pass

class CCEventConnect(CCEventGeneric):
    name = 'CCEventConnect'
    pass

class CCEventUpdate(CCEventGeneric):
    name = 'CCEventUpdate'
    pass

class CCEventInfo(CCEventGeneric):
    name = 'CCEventInfo'
    pass

class CCEventDisconnect(CCEventGeneric):
    name = 'CCEventDisconnect'
    pass

class CCEventFail(CCEventGeneric):
    name = 'CCEventFail'
    pass

class CCEventRedirect(CCEventGeneric):
    name = 'CCEventRedirect'
    pass

# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY 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.
#
# For a license to use the SIPPY software under conditions
# other than those described here, or to purchase support for this
# software, please contact Sippy Software, Inc. by e-mail at the
# following addresses: sales@sippysoft.com.
#
# SIPPY 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.
#
# $Id: CCEvents.py,v 1.5 2009/07/01 20:39:22 sobomax Exp $

from time import time

class CCEventGeneric(object):
    data = None
    name = None
    rtime = None
    origin = None
    seq = 1

    def __init__(self, data = None, rtime = None, origin = None):
        self.data = data
        if rtime == None:
            self.rtime = time()
        else:
            self.rtime = rtime
        self.seq = CCEventGeneric.seq
        CCEventGeneric.seq += 1
        self.origin = origin

    def getData(self):
        return self.data

    def __str__(self):
        return self.name

class CCEventTry(CCEventGeneric):
    name = 'CCEventTry'
    pass

class CCEventRing(CCEventGeneric):
    name = 'CCEventRing'
    pass

class CCEventConnect(CCEventGeneric):
    name = 'CCEventConnect'
    pass

class CCEventUpdate(CCEventGeneric):
    name = 'CCEventUpdate'
    pass

class CCEventInfo(CCEventGeneric):
    name = 'CCEventInfo'
    pass

class CCEventDisconnect(CCEventGeneric):
    name = 'CCEventDisconnect'
    pass

class CCEventFail(CCEventGeneric):
    name = 'CCEventFail'
    pass

class CCEventRedirect(CCEventGeneric):
    name = 'CCEventRedirect'
    pass

Add sequence number that is monotonically increase and optional origin parameter to be set on the instantiation time.