Shaka Packager SDK
Loading...
Searching...
No Matches
udp_options.h
1// Copyright 2016 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#include <memory>
8#include <string>
9
10namespace shaka {
11
14 public:
15 ~UdpOptions() = default;
16
20 static std::unique_ptr<UdpOptions> ParseFromString(std::string_view udp_url);
21
22 const std::string& address() const { return address_; }
23 uint16_t port() const { return port_; }
24 bool reuse() const { return reuse_; }
25 const std::string& interface_address() const { return interface_address_; }
26 unsigned timeout_us() const { return timeout_us_; }
27 const std::string& source_address() const { return source_address_; }
28 bool is_source_specific_multicast() const {
29 return is_source_specific_multicast_;
30 }
31 int buffer_size() const { return buffer_size_; }
32
33 private:
34 UdpOptions() = default;
35
36 // IP Address.
37 std::string address_ = "0.0.0.0";
38 uint16_t port_ = 0;
39 // Allow or disallow reusing UDP sockets.
40 bool reuse_ = false;
41 // Address of the interface over which to receive UDP multicast streams.
42 std::string interface_address_ = "0.0.0.0";
43 // Timeout in microseconds. 0 to indicate unlimited timeout.
44 unsigned timeout_us_ = 0;
45 // Source specific multicast source address
46 std::string source_address_ = "0.0.0.0";
47 bool is_source_specific_multicast_ = false;
48 // Maximum receive buffer size in bytes.
49 // Note that the actual buffer size is capped by the maximum buffer size set
50 // by the underlying operating system ('sysctl net.core.rmem_max' on Linux
51 // returns the maximum receive memory size).
52 int buffer_size_ = 0;
53};
54
55} // namespace shaka
Options parsed from UDP url string of the form: udp://ip:port[?options].
Definition udp_options.h:13
static std::unique_ptr< UdpOptions > ParseFromString(std::string_view udp_url)
All the methods that are virtual are virtual for mocking.