]> git.tdb.fi Git - libs/net.git/blob - source/net/constants.cpp
Move most platform-specific code into overlay directories
[libs/net.git] / source / net / constants.cpp
1 #include <stdexcept>
2 #include "platform_api.h"
3 #include "constants.h"
4
5 using namespace std;
6
7 namespace Msp {
8 namespace Net {
9
10 int family_to_sys(Family f)
11 {
12         switch(f)
13         {
14         case UNSPEC: return AF_UNSPEC;
15         case INET:   return AF_INET;
16         case INET6:  return AF_INET6;
17         case UNIX:   return AF_UNIX;
18         default: throw invalid_argument("family_to_sys");
19         }
20 }
21
22 Family family_from_sys(int f)
23 {
24         switch(f)
25         {
26         case AF_UNSPEC: return UNSPEC;
27         case AF_INET:   return INET;
28         case AF_INET6:  return INET6;
29         case AF_UNIX:   return UNIX;
30         default: throw invalid_argument("family_from_sys");
31         }
32 }
33
34 } // namespace Net
35 } // namespace Msp