1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef nricestunaddr_h__
6 #define nricestunaddr_h__
7 
8 #include "nsError.h"  // for nsresult
9 
10 typedef struct nr_local_addr_ nr_local_addr;
11 
12 namespace mozilla {
13 
14 class NrIceStunAddr {
15  public:
16   NrIceStunAddr();  // needed for IPC deserialization
17   explicit NrIceStunAddr(const nr_local_addr* addr);
18   NrIceStunAddr(const NrIceStunAddr& rhs);
19 
20   ~NrIceStunAddr();
21 
localAddr()22   const nr_local_addr& localAddr() const { return *localAddr_; }
23 
24   // serialization/deserialization helper functions for use
25   // in dom/media/webrtc/transport/ipc/NrIceStunAddrMessagUtils.h
26   size_t SerializationBufferSize() const;
27   nsresult Serialize(char* buffer, size_t buffer_size) const;
28   nsresult Deserialize(const char* buffer, size_t buffer_size);
29 
30  private:
31   nr_local_addr* localAddr_;
32 };
33 
34 }  // namespace mozilla
35 
36 #endif  // nricestunaddr_h__
37