sipxtacklib  Version 3.3
PidfBody.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2005 SIPez LLC.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 // Author: Daniel Petrie (dpetrie AT SIPez DOT com)
12 
13 
14 #ifndef _PidfBody_h_
15 #define _PidfBody_h_
16 
17 // SYSTEM INCLUDES
18 
19 
20 // APPLICATION INCLUDES
21 #include <net/HttpBody.h>
22 #include <utl/UtlDList.h>
23 
24 // DEFINES
25 // MACROS
26 // EXTERNAL FUNCTIONS
27 // EXTERNAL VARIABLES
28 // CONSTANTS
29 // STRUCTS
30 // TYPEDEFS
31 // FORWARD DECLARATIONS
32 
34 
36 class PidfBody : public HttpBody
37 {
38 /* //////////////////////////// PUBLIC //////////////////////////////////// */
39 public:
40 
41 
42 /* ============================ CREATORS ================================== */
43 
45  PidfBody(const char* resourceAor = NULL);
46 
48  PidfBody(const char* bytes,
49  int length,
50  const char* contentEncodingValueString);
51 
53  PidfBody(const PidfBody& rPidfBody);
54 
56  virtual ~PidfBody();
57 
58 /* ============================ MANIPULATORS ============================== */
59 
61  PidfBody& operator=(const PidfBody& rhs);
62 
64 
68  void render();
69 
70 
71  static int parseXmlToPidfProperties(const char* bytes,
72  int length,
73  const char* contentEncodingValueString,
74  UtlString& entityAor,
75  UtlDList& tuples);
76 
77 /* ============================ ACCESSORS ================================= */
78 
80  void getEntityAor(UtlString& entityAor) const;
81 
83 
86  virtual void getBytes(const char** bytes, int* length) const;
87  virtual void getBytes(UtlString* bytes, int* length) const;
88 
90 
97  UtlBoolean getBasicStatus(int tupleIndex,
98  UtlString& tupleId,
99  UtlBoolean& isTupleStatusBasicOpen,
100  UtlString& contact,
101  UtlString& tupleNote) const;
102 
104  void addBasicStatus(const UtlString& tupleId,
105  const UtlBoolean& isTupleStatusBasicOpen,
106  const UtlString& contact,
107  const UtlString& tupleNote);
108 
110  UtlBoolean changeBasicStatus(int tupleIndex,
111  UtlBoolean isTupleStatusBasicOpen);
112 
113 /* ============================ INQUIRY =================================== */
114 
115 
116 
117 /* //////////////////////////// PROTECTED ///////////////////////////////// */
118 protected:
119 
120 
121 /* //////////////////////////// PRIVATE /////////////////////////////////// */
122 private:
123 
124  // These will probably need to be lists
125  UtlString mEntityAor; // Address of Record
126  UtlDList mTuples;
127 
128  UtlBoolean mRendered; // Has been rendered to XML body string in mBody
129 
130  void renderPidfXmlHeader(const UtlString& entityAor);
131  void renderPidfTuple(const UtlString& tupleId,
132  const UtlBoolean isTupleStatusBasicOpen,
133  const UtlString& tupleContact,
134  const UtlString& tupleNote);
135  void renderPidfXmlFooter();
136 
137  void copyTuples(const UtlDList& sourceList, UtlDList& targetList);
138 };
139 
140 /* ============================ INLINE METHODS ============================ */
141 
142 #endif // _PidfBody_h_
UtlBoolean changeBasicStatus(int tupleIndex, UtlBoolean isTupleStatusBasicOpen)
Change the basic element value in the indicated tuple element.
Definition: PidfBody.cpp:306
UtlBoolean getBasicStatus(int tupleIndex, UtlString &tupleId, UtlBoolean &isTupleStatusBasicOpen, UtlString &contact, UtlString &tupleNote) const
Get the presense status/state.
Definition: PidfBody.cpp:282
PidfBody & operator=(const PidfBody &rhs)
Assignment operator.
Definition: PidfBody.cpp:130
virtual const char * getBytes() const
Definition: HttpBody.cpp:476
static int parseXmlToPidfProperties(const char *bytes, int length, const char *contentEncodingValueString, UtlString &entityAor, UtlDList &tuples)
Definition: PidfBody.cpp:173
void getEntityAor(UtlString &entityAor) const
Get the AOR (PIDF presence element, entity attribute) for the PIDF doc.
Definition: PidfBody.cpp:257
void render()
Render the PIDF data into the XML format of the body.
Definition: PidfBody.cpp:148
PidfBody(const char *resourceAor=NULL)
Default constructor.
Definition: PidfBody.cpp:69
void addBasicStatus(const UtlString &tupleId, const UtlBoolean &isTupleStatusBasicOpen, const UtlString &contact, const UtlString &tupleNote)
Set the presence status/state.
Definition: PidfBody.cpp:319
virtual ~PidfBody()
Destructor.
Definition: PidfBody.cpp:120
class to contain an PIDF presense state body
Definition: PidfBody.h:36
class to contain an HTTP body
Definition: HttpBody.h:55

sipXtackLib home page