PcapPlusPlus  Next
SdpLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "IpAddress.h"
4 #include "TextBasedProtocol.h"
5 #include <vector>
6 
8 
13 namespace pcpp
14 {
15 
17 #define PCPP_SDP_PROTOCOL_VERSION_FIELD "v"
19 #define PCPP_SDP_ORIGINATOR_FIELD "o"
21 #define PCPP_SDP_SESSION_NAME_FIELD "s"
23 #define PCPP_SDP_INFO_FIELD "i"
25 #define PCPP_SDP_URI_FIELD "u"
27 #define PCPP_SDP_EMAIL_FIELD "e"
29 #define PCPP_SDP_PHONE_FIELD "p"
31 #define PCPP_SDP_CONNECTION_INFO_FIELD "c"
33 #define PCPP_SDP_BANDWIDTH_FIELD "b"
35 #define PCPP_SDP_TIME_FIELD "t"
37 #define PCPP_SDP_REPEAT_TIMES_FIELD "r"
39 #define PCPP_SDP_TIME_ZONE_FIELD "z"
41 #define PCPP_SDP_ENCRYPTION_KEY_FIELD "k"
43 #define PCPP_SDP_MEDIA_ATTRIBUTE_FIELD "a"
45 #define PCPP_SDP_MEDIA_NAME_FIELD "m"
46 
60  {
61  public:
68  SdpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
69 
74 
95  SdpLayer(const std::string& username, long sessionID, long sessionVersion, IPv4Address ipAddress,
96  const std::string& sessionName, long startTime, long stopTime);
97 
98  ~SdpLayer() override = default;
99 
106  {}
107 
113  SdpLayer& operator=(const SdpLayer& other)
114  {
115  TextBasedProtocolMessage::operator=(other);
116  return *this;
117  }
118 
128 
139  uint16_t getMediaPort(const std::string& mediaType) const;
140 
161  bool addMediaDescription(const std::string& mediaType, uint16_t mediaPort, const std::string& mediaProtocol,
162  const std::string& mediaFormat, const std::vector<std::string>& mediaAttributes);
163 
164  // overridden methods
165 
167  {
168  return OsiModelSesionLayer;
169  }
170 
171  std::string toString() const override;
172 
173  protected:
174  // implementation of abstract methods
175  char getHeaderFieldNameValueSeparator() const override
176  {
177  return '=';
178  }
179  bool spacesAllowedBetweenHeaderFieldNameAndValue() const override
180  {
181  return false;
182  }
183  };
184 } // namespace pcpp
Definition: IpAddress.h:32
Definition: Layer.h:69
Definition: Packet.h:27
Definition: SdpLayer.h:60
SdpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
uint16_t getMediaPort(const std::string &mediaType) const
IPv4Address getOwnerIPv4Address() const
SdpLayer(const std::string &username, long sessionID, long sessionVersion, IPv4Address ipAddress, const std::string &sessionName, long startTime, long stopTime)
SdpLayer(const SdpLayer &other)
Definition: SdpLayer.h:105
SdpLayer & operator=(const SdpLayer &other)
Definition: SdpLayer.h:113
std::string toString() const override
bool addMediaDescription(const std::string &mediaType, uint16_t mediaPort, const std::string &mediaProtocol, const std::string &mediaFormat, const std::vector< std::string > &mediaAttributes)
OsiModelLayer getOsiModelLayer() const override
Definition: SdpLayer.h:166
Definition: TextBasedProtocol.h:123
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelSesionLayer
Definition: ProtocolType.h:374