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