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 <cstdint>
8#include <memory>
9#include <string>
10
11namespace shaka {
12
15 public:
16 ~UdpOptions() = default;
17
21 static std::unique_ptr<UdpOptions> ParseFromString(std::string_view udp_url);
22
23 const std::string& address() const { return address_; }
24 uint16_t port() const { return port_; }
25 bool reuse() const { return reuse_; }
26 const std::string& interface_address() const { return interface_address_; }
27 unsigned timeout_us() const { return timeout_us_; }
28 const std::string& source_address() const { return source_address_; }
29 bool is_source_specific_multicast() const {
30 return is_source_specific_multicast_;
31 }
32 int buffer_size() const { return buffer_size_; }
33
34 private:
35 UdpOptions() = default;
36
37 // IP Address.
38 std::string address_ = "0.0.0.0";
39 uint16_t port_ = 0;
40 // Allow or disallow reusing UDP sockets.
41 bool reuse_ = false;
42 // Address of the interface over which to receive UDP multicast streams.
43 std::string interface_address_ = "0.0.0.0";
44 // Timeout in microseconds. 0 to indicate unlimited timeout.
45 unsigned timeout_us_ = 0;
46 // Source specific multicast source address
47 std::string source_address_ = "0.0.0.0";
48 bool is_source_specific_multicast_ = false;
49 // Maximum receive buffer size in bytes.
50 // Note that the actual buffer size is capped by the maximum buffer size set
51 // by the underlying operating system ('sysctl net.core.rmem_max' on Linux
52 // returns the maximum receive memory size).
53 int buffer_size_ = 0;
54};
55
56} // namespace shaka
Options parsed from UDP url string of the form: udp://ip:port[?options].
Definition udp_options.h:14
static std::unique_ptr< UdpOptions > ParseFromString(std::string_view udp_url)
All the methods that are virtual are virtual for mocking.