PcapPlusPlus  21.05
SdpLayer.h
Go to the documentation of this file.
1 #ifndef PACKETPP_SDP_LAYER
2 #define PACKETPP_SDP_LAYER
3 
4 #include "IpAddress.h"
5 #include "TextBasedProtocol.h"
6 #include <vector>
7 
9 
14 namespace pcpp
15 {
16 
18 #define PCPP_SDP_PROTOCOL_VERSION_FIELD "v"
19 
20 #define PCPP_SDP_ORIGINATOR_FIELD "o"
21 
22 #define PCPP_SDP_SESSION_NAME_FIELD "s"
23 
24 #define PCPP_SDP_INFO_FIELD "i"
25 
26 #define PCPP_SDP_URI_FIELD "u"
27 
28 #define PCPP_SDP_EMAIL_FIELD "e"
29 
30 #define PCPP_SDP_PHONE_FIELD "p"
31 
32 #define PCPP_SDP_CONNECTION_INFO_FIELD "c"
33 
34 #define PCPP_SDP_BANDWIDTH_FIELD "b"
35 
36 #define PCPP_SDP_TIME_FIELD "t"
37 
38 #define PCPP_SDP_REPEAT_TIMES_FIELD "r"
39 
40 #define PCPP_SDP_TIME_ZONE_FIELD "z"
41 
42 #define PCPP_SDP_ENCRYPTION_KEY_FIELD "k"
43 
44 #define PCPP_SDP_MEDIA_ATTRIBUTE_FIELD "a"
45 
46 #define PCPP_SDP_MEDIA_NAME_FIELD "m"
47 
60  {
61  public:
62 
69  SdpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
70 
74  SdpLayer();
75 
96  SdpLayer(std::string username, long sessionID, long sessionVersion, IPv4Address ipAddress, std::string sessionName, long startTime, long stopTime);
97 
98  ~SdpLayer() {}
99 
105  SdpLayer(const SdpLayer& other) : TextBasedProtocolMessage(other) {}
106 
112  SdpLayer& operator=(const SdpLayer& other) { TextBasedProtocolMessage::operator=(other); return *this; }
113 
122 
131  uint16_t getMediaPort(std::string mediaType) const;
132 
152  bool addMediaDescription(std::string mediaType, uint16_t mediaPort, std::string mediaProtocol, std::string mediaFormat, std::vector<std::string> mediaAttributes);
153 
154  // overridden methods
155 
157 
158  std::string toString() const;
159 
160  protected:
161 
162  // implementation of abstract methods
163  char getHeaderFieldNameValueSeparator() const { return '='; }
164  bool spacesAllowedBetweenHeaderFieldNameAndValue() const { return false; }
165 
166  };
167 }
168 
169 #endif // PACKETPP_SDP_LAYER
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
SdpLayer(const SdpLayer &other)
Definition: SdpLayer.h:105
Definition: Layer.h:70
uint16_t getMediaPort(std::string mediaType) const
Definition: Packet.h:26
bool addMediaDescription(std::string mediaType, uint16_t mediaPort, std::string mediaProtocol, std::string mediaFormat, std::vector< std::string > mediaAttributes)
Definition: SdpLayer.h:59
Definition: TextBasedProtocol.h:113
Definition: IpAddress.h:26
OsiModelLayer getOsiModelLayer() const
Definition: SdpLayer.h:156
IPv4Address getOwnerIPv4Address() const
Definition: ProtocolType.h:264
std::string toString() const
SdpLayer & operator=(const SdpLayer &other)
Definition: SdpLayer.h:112