uvgRTP
session.hh
1 #pragma once
2 
3 #include <mutex>
4 #include <string>
5 #include <vector>
6 
7 #include "media_stream.hh"
8 #include "zrtp.hh"
9 
10 namespace uvgrtp {
11 
12  class session {
13  public:
15  session(std::string addr);
16  session(std::string remote_addr, std::string local_addr);
17  ~session();
19 
50  uvgrtp::media_stream *create_stream(int src_port, int dst_port, rtp_format_t fmt, int flags);
51 
63  rtp_error_t destroy_stream(uvgrtp::media_stream *stream);
64 
66  /* Get unique key of the session
67  * Used by context to index sessions */
68  std::string& get_key();
70 
71  private:
72  /* Each RTP multimedia session shall have one ZRTP session from which all session are derived */
73  uvgrtp::zrtp *zrtp_;
74 
75  /* Each RTP multimedia session is always IP-specific */
76  std::string addr_;
77 
78  /* If user so wishes, the session can be bound to a certain interface */
79  std::string laddr_;
80 
81  /* All media streams of this session */
82  std::unordered_map<uint32_t, uvgrtp::media_stream *> streams_;
83 
84  std::mutex session_mtx_;
85  };
86 };
87 
88 namespace uvg_rtp = uvgrtp;
Definition: media_stream.hh:18
Definition: session.hh:12
rtp_error_t destroy_stream(uvgrtp::media_stream *stream)
Destroy a media stream.
uvgrtp::media_stream * create_stream(int src_port, int dst_port, rtp_format_t fmt, int flags)
Create a bidirectional media stream for an RTP session.