1<!-- Creator     : groff version 1.22.2 -->
2<!-- CreationDate: Thu Feb  2 23:56:35 2017 -->
3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4"http://www.w3.org/TR/html4/loose.dtd">
5<html>
6<head>
7<meta name="generator" content="groff -Thtml, see www.gnu.org">
8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
9<meta name="Content-Style" content="text/css">
10<style type="text/css">
11       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
12       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
13       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
14       h1      { text-align: center }
15</style>
16<title>mtcp_setsockopt</title>
17<link rel="stylesheet" href="./common.css">
18</head>
19<body>
20<div class="main">
21<h1 align="center">mtcp_setsockopt</h1>
22<!--
23<a href="#NAME">NAME</a><br>
24<a href="#SYNOPSIS">SYNOPSIS</a><br>
25<a href="#DESCRIPTION">DESCRIPTION</a><br>
26<a href="#RETURN VALUE">RETURN VALUE</a><br>
27<a href="#ERRORS">ERRORS</a><br>
28<a href="#AUTHORS">AUTHORS</a><br>
29<a href="#SEE ALSO">SEE ALSO</a><br>
30<a href="#COLOPHON">COLOPHON</a><br>
31<hr>
32-->
33
34<h2>NAME
35<a name="NAME"></a>
36</h2>
37
38
39
40<p style="margin-left:11%; margin-top: 1em">mtcp_setsockopt
41&minus; set options on mTCP/mOS sockets</p>
42
43<h2>SYNOPSIS
44<a name="SYNOPSIS"></a>
45</h2>
46
47
48<p style="margin-left:11%; margin-top: 1em"><b>#include
49&lt;mtcp_api.h&gt;</b></p>
50
51<p style="margin-left:11%; margin-top: 1em"><b>int
52mtcp_setsockopt(mctx_t</b> <i>mctx</i><b>, int</b>
53<i>sockid</i><b>, int</b> <i>level</i><b>, int</b>
54<i>optname</i><b>, const void *</b><i>optval</i><b>,
55socklen_t</b> <i>optlen</i><b>);</b></p>
56
57<h2>DESCRIPTION
58<a name="DESCRIPTION"></a>
59</h2>
60
61
62
63<p style="margin-left:11%; margin-top: 1em"><b>mtcp_setsockopt</b>()
64manipulate options for the socket referred to by the
65<i>sockid</i> descriptor. These options may exist at
66multiple protocol levels. When manipulating socket options,
67the level at which the options resides and the name of the
68option must be specified. A user can use
69<b>SOL_MONSOCKET</b> <i>level</i> to adjust options for
70monitoring sockets.</p>
71
72<p style="margin-left:11%; margin-top: 1em">The arguments
73<i>optval</i> and <i>optlen</i> are used to set options
74values for mtcp_setsockopt().</p>
75
76<p style="margin-left:11%; margin-top: 1em">SOL_MONSOCKET
77socket <i>level</i> can be used by <b>mtcp_setsockopt()</b>
78to set a number of attributes pertaining to the socket.</p>
79
80<table width="100%" border="0" rules="none" frame="void"
81       cellspacing="0" cellpadding="0">
82<tr valign="top" align="left">
83<td width="11%"></td>
84<td width="15%">
85
86
87<p style="margin-top: 1em">MOS_CLIBUF</p></td>
88<td width="23%"></td>
89<td width="51%">
90
91
92<p style="margin-top: 1em">Dynamically adjust the size of
93the TCP receive ring buffer of the emulated client stack.
94The <i>optval</i> contains the size of the buffer that needs
95to be set as int, while <i>optlen</i> is equal to
96sizeof(int).</p> </td></tr>
97<tr valign="top" align="left">
98<td width="11%"></td>
99<td width="15%">
100
101
102<p>MOS_SVRBUF</p></td>
103<td width="23%"></td>
104<td width="51%">
105
106
107<p>Dynamically adjust the size of the TCP receive ring
108buffer of the emulated client stack. The <i>optval</i>
109contains the size of the buffer that needs to be set as int,
110while <i>optlen</i> is equal to sizeof(int).</p></td></tr>
111<tr valign="top" align="left">
112<td width="11%"></td>
113<td width="21%">
114
115
116<p>MOS_CLIOVERLAP</p></td>
117<td width="17%"></td>
118<td width="51%">
119
120
121<p>Dynamically determine the policy on content overlap
122(e.g., overwriting with the retransmitted payload or not)
123for the client-side buffer. The <i>optval</i> can be either
124MOS_OVERLAP_POLICY_FIRST (to take the first data and never
125overwrite the buffer) or MOS_OVERLAP_POLICY_LAST (to always
126update the buffer with the last data), and <i>optlen</i> is
127equal to sizeof(int).</p></td></tr>
128<tr valign="top" align="left">
129<td width="11%"></td>
130<td width="21%">
131
132
133<p>MOS_SVROVERLAP</p></td>
134<td width="17%"></td>
135<td width="51%">
136
137
138<p>Dynamically determine the policy on content overlap
139(e.g., overwriting with the retransmitted payload or not)
140for the server-side buffer. The <i>optval</i> can be either
141MOS_OVERLAP_POLICY_FIRST (to take the first data and never
142overwrite the buffer) or MOS_OVERLAP_POLICY_LAST (to always
143update the buffer with the last data), and <i>optlen</i> is
144equal to sizeof(int).</p></td></tr>
145<tr valign="top" align="left">
146<td width="11%"></td>
147<td width="21%">
148
149
150<p>MOS_STOP_MON</p></td>
151<td width="17%"></td>
152<td width="51%">
153
154
155<p>Dynamically stop monitoring a flow for the specific
156side. This option can be used only with a
157MOS_SOCK_MONITOR_ACTIVE socket, which is given as a
158parameter in callback functions for every flow. The
159<i>optval</i> contains a side variable (MOS_SIDE_CLI,
160MOS_SIDE_SVR, or MOS_SIDE_BOTH), while <i>optlen</i> is
161equal to sizeof(int).</p></td></tr>
162</table>
163
164<h2>RETURN VALUE
165<a name="RETURN VALUE"></a>
166</h2>
167
168
169<p style="margin-left:11%; margin-top: 1em">Returns 0 on
170success; -1 on failure. In case of failure, <i>errno</i> is
171set appropriately.</p>
172
173<h2>ERRORS
174<a name="ERRORS"></a>
175</h2>
176
177
178<table width="100%" border="0" rules="none" frame="void"
179       cellspacing="0" cellpadding="0">
180<tr valign="top" align="left">
181<td width="11%"></td>
182<td width="12%">
183
184
185<p style="margin-top: 1em"><b>EACCES</b></p></td>
186<td width="3%"></td>
187<td width="74%">
188
189
190<p style="margin-top: 1em"><i>mctx</i> is not valid.</p></td></tr>
191<tr valign="top" align="left">
192<td width="11%"></td>
193<td width="12%">
194
195
196<p><b>EBADF</b></p></td>
197<td width="3%"></td>
198<td width="74%">
199
200
201<p><i>sockid</i> is not a valid socket descriptor.</p></td></tr>
202<tr valign="top" align="left">
203<td width="11%"></td>
204<td width="12%">
205
206
207<p><b>ENOTSOCK</b></p></td>
208<td width="3%"></td>
209<td width="74%">
210
211
212<p>The socket referred to by <i>sockid</i> is not
213valid.</p> </td></tr>
214<tr valign="top" align="left">
215<td width="11%"></td>
216<td width="12%">
217
218
219<p><b>ENOSYS</b></p></td>
220<td width="3%"></td>
221<td width="74%">
222
223
224<p>Either the <i>level</i> or the <i>optname</i> is not
225implemented.</p> </td></tr>
226<tr valign="top" align="left">
227<td width="11%"></td>
228<td width="12%">
229
230
231<p><b>EPERM</b></p></td>
232<td width="3%"></td>
233<td width="74%">
234
235
236<p>Permission to access a socket option is denied.</p></td></tr>
237</table>
238
239<h2>AUTHORS
240<a name="AUTHORS"></a>
241</h2>
242
243
244<p style="margin-left:22%; margin-top: 1em">mOS development
245team &lt;[email protected]&gt;</p>
246
247
248<!----------------------------------------------------------->
249<h2>EXAMPLES
250  <a name="EXAMPLES"></a>
251</h2>
252
253<p style="margin-left:11%; margin-top: 1em">
254  <a href="http://mos.kaist.edu/guide/programmer/05_api_example.html#setting-monitoring-policy">
255	http://mos.kaist.edu/guide/programmer/05_api_example.html#setting-monitoring-policy
256  </a>
257  <a href="http://mos.kaist.edu/guide/programmer/05_api_example.html#disabling-packet-flow-monitoring">
258	http://mos.kaist.edu/guide/programmer/05_api_example.html#disabling-packet-flow-monitoring
259  </a>
260</p>
261<!----------------------------------------------------------->
262
263<h2>SEE ALSO
264<a name="SEE ALSO"></a>
265</h2>
266
267
268
269<p style="margin-left:11%; margin-top: 1em"><b>mtcp_socket</b>(),
270<b>mtcp_getsockopt</b>()</p>
271
272<h2>COLOPHON
273<a name="COLOPHON"></a>
274</h2>
275
276
277<p style="margin-left:11%; margin-top: 1em">This page is
278part of mOS release 0.3 <i>docs</i> section. A description
279of the project, and information about reporting bugs, can be
280found at http://mos.kaist.edu/.</p>
281<!-- <hr>-->
282<br>
283<div class="footer">
284  <img src="back-arrow.jpg" width="2%" height="2%"><a href="http://mos.kaist.edu/index_man.html">Back to Index</a>
285</div>
286</div>
287</body>
288</html>
289