/src/mozilla-central/media/webrtc/signaling/src/sdp/SdpEnum.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef _SDPENUM_H_ |
8 | | #define _SDPENUM_H_ |
9 | | |
10 | | #include <ostream> |
11 | | |
12 | | #include "mozilla/Assertions.h" |
13 | | |
14 | | namespace mozilla |
15 | | { |
16 | | namespace sdp |
17 | | { |
18 | | |
19 | | enum NetType { kNetTypeNone, kInternet }; |
20 | | |
21 | | inline std::ostream& operator<<(std::ostream& os, sdp::NetType t) |
22 | 0 | { |
23 | 0 | switch (t) { |
24 | 0 | case sdp::kNetTypeNone: |
25 | 0 | MOZ_ASSERT(false); |
26 | 0 | return os << "NONE"; |
27 | 0 | case sdp::kInternet: |
28 | 0 | return os << "IN"; |
29 | 0 | } |
30 | 0 | MOZ_CRASH("Unknown NetType"); |
31 | 0 | } |
32 | | |
33 | | enum AddrType { kAddrTypeNone, kIPv4, kIPv6 }; |
34 | | |
35 | | inline std::ostream& operator<<(std::ostream& os, sdp::AddrType t) |
36 | 0 | { |
37 | 0 | switch (t) { |
38 | 0 | case sdp::kAddrTypeNone: |
39 | 0 | MOZ_ASSERT(false); |
40 | 0 | return os << "NONE"; |
41 | 0 | case sdp::kIPv4: |
42 | 0 | return os << "IP4"; |
43 | 0 | case sdp::kIPv6: |
44 | 0 | return os << "IP6"; |
45 | 0 | } |
46 | 0 | MOZ_CRASH("Unknown AddrType"); |
47 | 0 | } |
48 | | |
49 | | enum Direction { |
50 | | // Start at 1 so these can be used as flags |
51 | | kSend = 1, |
52 | | kRecv = 2 |
53 | | }; |
54 | | |
55 | | inline std::ostream& operator<<(std::ostream& os, sdp::Direction d) |
56 | 0 | { |
57 | 0 | switch (d) { |
58 | 0 | case sdp::kSend: |
59 | 0 | return os << "send"; |
60 | 0 | case sdp::kRecv: |
61 | 0 | return os << "recv"; |
62 | 0 | } |
63 | 0 | MOZ_CRASH("Unknown Direction"); |
64 | 0 | } |
65 | | |
66 | | } // namespace sdp |
67 | | |
68 | | } // namespace mozilla |
69 | | |
70 | | #endif |