1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     socket_Const.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 29574 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_SOCKET_SOCKET_CONST_H_
17 #define NN_SOCKET_SOCKET_CONST_H_
18 
19 #include <nn/types.h>
20 #include <nn/socket/socket_Types.h>
21 
22 namespace nn {
23 namespace socket {
24 
25     const size_t ETH_ALEN               = NN_SOCKET_ETH_ALEN;
26     const size_t IP_ALEN                = NN_SOCKET_IP_ALEN;
27     const size_t IP6_ALEN               = NN_SOCKET_IP6_ALEN;
28     const size_t INET_ADDRSTRLEN        = NN_SOCKET_INET_ADDRSTRLEN;
29     const size_t INET6_ADDRSTRLEN       = NN_SOCKET_INET6_ADDRSTRLEN;
30 
31     const s32 DNS_NAME_MAX              = NN_SOCKET_DNS_NAME_MAX;
32     const s32 MAXDNAME                  = NN_SOCKET_MAXDNAME;
33     const s32 DNS_RESOLV_ADDRESS_MAX    = NN_SOCKET_DNS_RESOLV_ADDRESS_MAX;
34     const s32 DNS_RESOLV_ALIASNAME_MAX  = NN_SOCKET_DNS_RESOLV_ALIASNAME_MAX;
35     const s32 DNSSERVER_NUM_MAX         = NN_SOCKET_DNSSERVER_NUM_MAX;
36 
37     const s32 SOCKET_MAX_PER_PROCESS    = 16;
38     const s32 INFTIM                    = -1;
39 
40     namespace detail{
41         const size_t    COPY_OR_MAP_THRESHOLD               = 4096*2;
42         const s32       SEND_TO_MULTI_ADDRESS_ARRAY_SIZE    = 512;
43         const s32       SEND_TO_MULTI_BUFFER_SIZE           = COPY_OR_MAP_THRESHOLD - SEND_TO_MULTI_ADDRESS_ARRAY_SIZE;
44 
45         // Resources required when assuming the concurrent use of DEFAULT_SOCKET_MAX number of sockets
46         const size_t    DEFAULT_SOCKET_MAX                  = 10;
47         // If you expect concurrent Read/Write operations, double the number of sockets
48         const size_t    DEFAULT_SESSION_MAX                 = DEFAULT_SOCKET_MAX * 2;
49         // Default size of the socket send/receive buffer
50         const size_t    DEFAULT_SOCKET_BUFFER_SIZE          = 32768;
51         // If a send/receive buffer having the default size is used, double the number of sockets for send/receive
52         const size_t    DEFAULT_SOCKET_BUFFER_TOTAL_SIZE    = (DEFAULT_SOCKET_BUFFER_SIZE * 2) * DEFAULT_SOCKET_MAX;
53     }
54 
55     const u8 IpAddrAny[] = {   0,   0,   0,   0 };
56 }
57 }
58 
59 #endif  // ifndef NN_SOCKET_SOCKET_CONST_H_
60