• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 
19 #ifndef OSCL_SOCKET_TUNEABLES_H_INCLUDED
20 #define OSCL_SOCKET_TUNEABLES_H_INCLUDED
21 
22 /*!
23 ** This file contains default definitions of all the
24 ** the tuning parameters for the Oscl sockets.
25 */
26 
27 /*!
28 ** If parameters are defined in osclconfig_io.h, those definitions
29 ** will take precedence over the ones in this file.
30 */
31 #include "osclconfig_io.h"
32 #include "osclconfig_proc.h"
33 
34 /*!
35 ** PV_SOCKET_REQUEST_AO_PRIORITY sets the priority of the socket request
36 ** completion AOs.
37 */
38 #ifndef PV_SOCKET_REQUEST_AO_PRIORITY
39 #define PV_SOCKET_REQUEST_AO_PRIORITY OsclActiveObject::EPriorityNominal
40 #endif
41 
42 /*!
43 ** Set this to 0 or 1 to enable/disable socket stats logging
44 ** with "OsclSocketStats" node.  This feature is fairly costly so should be off in
45 ** production code.
46 */
47 #ifndef PV_OSCL_SOCKET_STATS_LOGGING
48 #define PV_OSCL_SOCKET_STATS_LOGGING 0
49 #endif
50 
51 /*!
52 ** Enable/disable the PV socket server here.
53 */
54 #ifndef PV_SOCKET_SERVER
55 #define PV_SOCKET_SERVER 1
56 #endif
57 
58 #if(PV_SOCKET_SERVER)
59 /*!
60 ** PV_SOCKET_SERVER_IS_THREAD chooses either the threaded or AO-based
61 ** implementation of the PV socket server
62 */
63 #ifndef PV_SOCKET_SERVER_IS_THREAD
64 //choose threaded implementation whenever the OS has threading support.
65 #define PV_SOCKET_SERVER_IS_THREAD OSCL_HAS_THREAD_SUPPORT
66 #endif
67 
68 /*!
69 ** PV_SOCKET_SERVER_SELECT chooses whether to use "select" call or not.
70 ** In threaded mode, select call is required and is forced to "1".
71 ** In AO mode, "select" call is an option that defaults to "0".
72 ** Avoiding any "select" call was found to greatly reduce CPU usage
73 ** on WinMobile devices.
74 */
75 #if PV_SOCKET_SERVER_IS_THREAD
76 #undef PV_SOCKET_SERVER_SELECT
77 #define PV_SOCKET_SERVER_SELECT 1
78 #else
79 #ifndef PV_SOCKET_SERVER_SELECT
80 #define PV_SOCKET_SERVER_SELECT 0
81 #endif
82 #endif
83 
84 /*!
85 ** PV_SOCKET_SERVER_THREAD_PRIORITY sets the priority of the PV socket
86 ** server thread.
87 */
88 #ifndef PV_SOCKET_SERVER_THREAD_PRIORITY
89 #define PV_SOCKET_SERVER_THREAD_PRIORITY ThreadPriorityAboveNormal
90 #endif
91 
92 /*!
93 ** PV_SOCKET_SERVER_SELECT_TIMEOUT_MSEC sets duration of the select call
94 ** in the PV socket server thread for the polling select loop implementation.
95 ** When the timeout is -1, the select call will block forever waiting on a new request
96 ** and will use a loopback socket to signal a new request.
97 ** Note: if infinite wait is selected, but loopback socket is not available,
98 ** the implementation will poll at 10 msec intervals.
99 */
100 #ifndef PV_SOCKET_SERVER_SELECT_TIMEOUT_MSEC
101 #define PV_SOCKET_SERVER_SELECT_TIMEOUT_MSEC (-1)
102 #endif
103 
104 /*!
105 ** PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET enables the feature to wakeup the select
106 ** call by writing to a loopback socket each time a new request comes in.
107 ** This option is required to support the blocking select loop option of threaded
108 ** server mode.  This option is forced to "0" in AO mode.
109 */
110 #if PV_SOCKET_SERVER_IS_THREAD
111 #ifndef PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET
112 #define PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET 1
113 #endif
114 #else
115 #undef PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET
116 #define PV_SOCKET_SERVER_SELECT_LOOPBACK_SOCKET 0
117 #endif
118 
119 /*!
120 ** PV_SOCKET_SERVER_AO_PRIORITY sets priority of the PV socket server
121 ** AO for non-threaded implementations.
122 */
123 #ifndef PV_SOCKET_SERVER_AO_PRIORITY
124 #define PV_SOCKET_SERVER_AO_PRIORITY (OsclActiveObject::EPriorityNominal)
125 #endif
126 
127 /*!
128 ** PV_SOCKET_SERVER_AO_INTERVAL_MSEC sets the AO scheduling interval
129 ** of the PV socket server AO for non-threaded implementations.
130 */
131 #ifndef PV_SOCKET_SERVER_AO_INTERVAL_MSEC
132 #define PV_SOCKET_SERVER_AO_INTERVAL_MSEC 5
133 #endif
134 
135 /*!
136 ** Set this to 0 or 1 to enable/disable PVLogger output from
137 ** PV socket server.
138 ** Note that socket server logging will appear in a different
139 ** file when running threaded mode of socket server.
140 ** This is quite a bit of logging, so it should generally be
141 ** disabled.
142 */
143 #ifndef PV_OSCL_SOCKET_SERVER_LOGGER_OUTPUT
144 #define PV_OSCL_SOCKET_SERVER_LOGGER_OUTPUT 0
145 #endif
146 
147 /*!
148 ** Set this to 0 or 1 to enable/disable setting the socket receive
149 ** buffer size to 1 MB in the Bind call.  This setting only affects
150 ** PV socket server implementations.
151 *
152 ** When set to 1, the code will use the OsclSetRecvBufferSize macro
153 ** to set the buffer size in the Bind  call.
154 *
155 ** This setting was found to improve streaming performance on
156 ** WinMobile devices, but should not generally be used.
157 */
158 #ifndef PV_OSCL_SOCKET_1MB_RECV_BUF
159 #define PV_OSCL_SOCKET_1MB_RECV_BUF 0
160 #endif
161 
162 /*!
163 ** For detailed performance breakdown of time spend in OsclSocketServI AO.
164 ** Output is logged under "OsclSchedulerPerfStats" node.  Should be off in
165 ** production code.  This option is forced to "0" in threaded mode.
166 */
167 #if PV_SOCKET_SERVER_IS_THREAD
168 #undef PV_SOCKET_SERVI_STATS
169 #define PV_SOCKET_SERVI_STATS 0
170 #else
171 #ifndef PV_SOCKET_SERVI_STATS
172 #define PV_SOCKET_SERVI_STATS 0
173 #endif
174 #endif
175 
176 #endif//PV_SOCKET_SERVER
177 
178 #endif
179 
180 
181 
182