Line data Source code
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 0 : inline std::ostream& operator<<(std::ostream& os, sdp::NetType t)
22 : {
23 0 : switch (t) {
24 : case sdp::kNetTypeNone:
25 0 : MOZ_ASSERT(false);
26 : return os << "NONE";
27 : case sdp::kInternet:
28 0 : return os << "IN";
29 : }
30 0 : MOZ_CRASH("Unknown NetType");
31 : }
32 :
33 : enum AddrType { kAddrTypeNone, kIPv4, kIPv6 };
34 :
35 0 : inline std::ostream& operator<<(std::ostream& os, sdp::AddrType t)
36 : {
37 0 : switch (t) {
38 : case sdp::kAddrTypeNone:
39 0 : MOZ_ASSERT(false);
40 : return os << "NONE";
41 : case sdp::kIPv4:
42 0 : return os << "IP4";
43 : case sdp::kIPv6:
44 0 : return os << "IP6";
45 : }
46 0 : MOZ_CRASH("Unknown AddrType");
47 : }
48 :
49 : enum Direction {
50 : // Start at 1 so these can be used as flags
51 : kSend = 1,
52 : kRecv = 2
53 : };
54 :
55 0 : inline std::ostream& operator<<(std::ostream& os, sdp::Direction d)
56 : {
57 0 : switch (d) {
58 : case sdp::kSend:
59 0 : return os << "send";
60 : case sdp::kRecv:
61 0 : return os << "recv";
62 : }
63 0 : MOZ_CRASH("Unknown Direction");
64 : }
65 :
66 : } // namespace sdp
67 :
68 : } // namespace mozilla
69 :
70 : #endif
|