reSIProcate/DialogUsageManager  9680
ContactInstanceRecord.hxx
Go to the documentation of this file.
00001 #if !defined(resip_ContactInstanceRecord_hxx)
00002 #define resip_ContactInstanceRecord_hxx
00003 
00004 #include <vector>
00005 #include <list>
00006 #include <deque>
00007 
00008 #include "resip/stack/NameAddr.hxx"
00009 #include "rutil/Data.hxx"
00010 #include "resip/stack/Tuple.hxx"
00011 #include "rutil/SharedPtr.hxx"
00012 
00013 namespace resip
00014 {
00015 static const UInt64 NeverExpire = 0xFFFFFFFFFFFFFFFFL;
00016 
00019 class ContactInstanceRecord 
00020 {
00021    public:
00022       ContactInstanceRecord();
00023       static ContactInstanceRecord makeRemoveDelta(const NameAddr& contact);
00024       static ContactInstanceRecord makeUpdateDelta(const NameAddr& contact, 
00025                                                    UInt64 expires,  // absolute time in secs
00026                                                    const SipMessage& msg);
00027       
00028       NameAddr mContact;    // can contain callee caps and q-values
00029       UInt64 mRegExpires;   // in seconds
00030       UInt64 mLastUpdated;  // in seconds
00031       Tuple mReceivedFrom;  // source transport, IP address, and port
00032       Tuple mPublicAddress; // Public IP address closest to the client (from Via headers): note: Tuple::getType == UNKNOWN_TRANPORT if no public address was found
00033       NameAddrs mSipPath;   // Value of SIP Path header from the request
00034       Data mInstance;       // From the instance parameter; usually a UUID URI
00035       UInt32 mRegId;        // From regid parameter of Contact header
00036       bool mSyncContact;    // This contact came from registration sync process, instead of direct SIP registration
00037       bool mUseFlowRouting; // Set to true when routing to this contact should use flow routing 
00038                             // Note:  There is no need to regsync this field, since such records will also have 
00039                             //        onlyUseExistingConnection set, and such contacts are not replicated.
00040       // Data mServerSessionId;// if there is no SIP Path header, the connection/session identifier 
00041       // Uri gruu;  (GRUU is currently derived)
00042       void      *mUserInfo;       
00043       
00044       bool operator==(const ContactInstanceRecord& rhs) const;
00045 };
00046 
00047 typedef std::list<ContactInstanceRecord> ContactList;
00048 
00051 typedef std::list<resip::SharedPtr<ContactInstanceRecord> > ContactPtrList;
00052         
00056 class ContactRecordTransaction
00057 {
00058    public:
00059 
00060    typedef enum Operation
00061    {
00062       none,
00063       update,
00064       create,
00065       remove,
00066       removeAll
00067    } Operation;
00068 
00069    ContactRecordTransaction()
00070       :mOp(none)
00071       {}
00072 
00073    ContactRecordTransaction(Operation op, resip::SharedPtr<ContactInstanceRecord> rec)
00074       :mOp(op),mRec(rec)
00075       {}
00076 
00077    Operation mOp;  
00078 
00080    resip::SharedPtr<ContactInstanceRecord> mRec;  
00081 };
00082 
00085 typedef std::deque<resip::SharedPtr<ContactRecordTransaction> > ContactRecordTransactionLog;
00086 
00087 class RegistrationBinding 
00088 {
00089    public:
00090       Data mAor;                      // canonical URI for this AOR and its aliases
00091       ContactList mContacts;
00092       std::vector<Uri> mAliases;     
00093 };
00094 
00095 struct RegistrationBindingDelta
00096 {
00097       Data mAor;
00098       std::vector<ContactInstanceRecord> mInserts;
00099       std::vector<ContactInstanceRecord> mUpdates;
00100       std::vector<ContactInstanceRecord> mRemoves;
00101 };
00102 }
00103 #endif