File: rtdm_8h-source.html

package info (click to toggle)
xenomai 2.5.4-3squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 36,140 kB
  • ctags: 35,509
  • sloc: ansic: 109,084; sh: 11,745; makefile: 2,205; xml: 1,356; asm: 613; php: 316; perl: 155
file content (359 lines) | stat: -rw-r--r-- 37,777 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: include/rtdm/rtdm.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
<h1>include/rtdm/rtdm.h</h1><a href="rtdm_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00047"></a>00047 <span class="preprocessor">#ifndef _RTDM_H</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define _RTDM_H</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050 <span class="preprocessor">#ifdef __KERNEL__</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &lt;linux/types.h&gt;</span>
<a name="l00053"></a>00053 <span class="preprocessor">#include &lt;linux/fcntl.h&gt;</span>
<a name="l00054"></a>00054 <span class="preprocessor">#include &lt;linux/ioctl.h&gt;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &lt;linux/sched.h&gt;</span>
<a name="l00056"></a>00056 <span class="preprocessor">#include &lt;linux/socket.h&gt;</span>
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="keyword">typedef</span> u32 socklen_t;
<a name="l00059"></a>00059 <span class="keyword">typedef</span> <span class="keyword">struct </span>task_struct rtdm_user_info_t;
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 <span class="preprocessor">#else </span><span class="comment">/* !__KERNEL__ */</span>
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="preprocessor">#include &lt;fcntl.h&gt;</span>
<a name="l00064"></a>00064 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00065"></a>00065 <span class="preprocessor">#include &lt;sys/ioctl.h&gt;</span>
<a name="l00066"></a>00066 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span>
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="preprocessor">#endif </span><span class="comment">/* !__KERNEL__ */</span>
<a name="l00069"></a>00069 
<a name="l00079"></a><a class="code" href="group__rtdm.html#gdd2020d36782ebb916b065d6554f2631">00079</a> <span class="preprocessor">#define RTDM_API_VER                    8</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span>
<a name="l00082"></a><a class="code" href="group__rtdm.html#g29d0fb2c233815a4a1d99f6a19f50b97">00082</a> <span class="preprocessor">#define RTDM_API_MIN_COMPAT_VER         6</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span>
<a name="l00087"></a><a class="code" href="group__rtdm.html#gd3b24c25feabadba465f8797d8c7fe27">00087</a> <span class="keyword">typedef</span> uint64_t <a class="code" href="group__rtdm.html#gd3b24c25feabadba465f8797d8c7fe27" title="RTDM type for representing absolute dates.">nanosecs_abs_t</a>;
<a name="l00088"></a>00088 
<a name="l00093"></a><a class="code" href="group__rtdm.html#gededf91e760e3268235351dcc9d9dcda">00093</a> <span class="keyword">typedef</span> int64_t <a class="code" href="group__rtdm.html#gededf91e760e3268235351dcc9d9dcda" title="RTDM type for representing relative intervals.">nanosecs_rel_t</a>;
<a name="l00094"></a>00094 
<a name="l00100"></a><a class="code" href="group__rtdm.html#gbdd7dfed8d8c38213f7edff5dc8b85a9">00100</a> <span class="preprocessor">#define RTDM_TIMEOUT_INFINITE           0</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00103"></a><a class="code" href="group__rtdm.html#g9d1d1557083c4b10226f360bea137fde">00103</a> <span class="preprocessor">#define RTDM_TIMEOUT_NONE               (-1)</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span>
<a name="l00116"></a>00116 <span class="preprocessor">#define RTDM_CLASS_PARPORT              1</span>
<a name="l00117"></a>00117 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_SERIAL               2</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_CAN                  3</span>
<a name="l00119"></a>00119 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_NETWORK              4</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_RTMAC                5</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_TESTING              6</span>
<a name="l00122"></a>00122 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_RTIPC                7</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span><span class="comment">/*</span>
<a name="l00124"></a>00124 <span class="comment">#define RTDM_CLASS_USB                  ?</span>
<a name="l00125"></a>00125 <span class="comment">#define RTDM_CLASS_FIREWIRE             ?</span>
<a name="l00126"></a>00126 <span class="comment">#define RTDM_CLASS_INTERBUS             ?</span>
<a name="l00127"></a>00127 <span class="comment">#define RTDM_CLASS_PROFIBUS             ?</span>
<a name="l00128"></a>00128 <span class="comment">#define ...</span>
<a name="l00129"></a>00129 <span class="comment">*/</span>
<a name="l00130"></a>00130 <span class="preprocessor">#define RTDM_CLASS_EXPERIMENTAL         224</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_CLASS_MAX                  255</span>
<a name="l00132"></a>00132 <span class="preprocessor"></span>
<a name="l00134"></a>00134 <span class="preprocessor">#define RTDM_SUBCLASS_GENERIC           (-1)</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span>
<a name="l00136"></a>00136 <span class="preprocessor">#define RTIOC_TYPE_COMMON               0</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span>
<a name="l00143"></a>00143 <span class="preprocessor">#define RTDM_MAX_DEVNAME_LEN            31</span>
<a name="l00144"></a>00144 <span class="preprocessor"></span>
<a name="l00149"></a><a class="code" href="structrtdm__device__info.html">00149</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structrtdm__device__info.html" title="Device information.">rtdm_device_info</a> {
<a name="l00151"></a><a class="code" href="structrtdm__device__info.html#7f651ee79cf7bd714b5556d505d8704c">00151</a>         <span class="keywordtype">int</span> <a class="code" href="structrtdm__device__info.html#7f651ee79cf7bd714b5556d505d8704c" title="Device flags, see Device Flags for details.">device_flags</a>;
<a name="l00152"></a>00152 
<a name="l00154"></a><a class="code" href="structrtdm__device__info.html#dd4bb1bdd7e6003bb348411f8c2c55f5">00154</a>         <span class="keywordtype">int</span> <a class="code" href="structrtdm__device__info.html#dd4bb1bdd7e6003bb348411f8c2c55f5" title="Device class ID, see RTDM_CLASS_xxx.">device_class</a>;
<a name="l00155"></a>00155 
<a name="l00159"></a><a class="code" href="structrtdm__device__info.html#8bad450810f6c6ef4027004c9838c37a">00159</a>         <span class="keywordtype">int</span> <a class="code" href="structrtdm__device__info.html#8bad450810f6c6ef4027004c9838c37a" title="Device sub-class, either RTDM_SUBCLASS_GENERIC or a RTDM_SUBCLASS_xxx definition...">device_sub_class</a>;
<a name="l00160"></a>00160 
<a name="l00162"></a><a class="code" href="structrtdm__device__info.html#646ca98c3ab6e74e140f008071c276c1">00162</a>         <span class="keywordtype">int</span> <a class="code" href="structrtdm__device__info.html#646ca98c3ab6e74e140f008071c276c1" title="Supported device profile version.">profile_version</a>;
<a name="l00163"></a>00163 } <a class="code" href="structrtdm__device__info.html" title="Device information.">rtdm_device_info_t</a>;
<a name="l00164"></a>00164 
<a name="l00169"></a>00169 <span class="preprocessor">#define RTDM_PURGE_RX_BUFFER            0x0001</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span><span class="preprocessor">#define RTDM_PURGE_TX_BUFFER            0x0002</span>
<a name="l00171"></a>00171 <span class="preprocessor"></span>
<a name="l00183"></a><a class="code" href="group__profiles.html#gae7eb728c73b844eed0ee612940c19ae">00183</a> <span class="preprocessor">#define RTIOC_DEVICE_INFO \</span>
<a name="l00184"></a>00184 <span class="preprocessor">        _IOR(RTIOC_TYPE_COMMON, 0x00, struct rtdm_device_info)</span>
<a name="l00185"></a>00185 <span class="preprocessor"></span>
<a name="l00190"></a><a class="code" href="group__profiles.html#gc6abf51719ec6aa6e31f98a237721e01">00190</a> <span class="preprocessor">#define RTIOC_PURGE             _IOW(RTIOC_TYPE_COMMON, 0x10, int)</span>
<a name="l00191"></a>00191 <span class="preprocessor"></span>
<a name="l00194"></a>00194 <span class="comment">/* Internally used for mapping socket functions on IOCTLs */</span>
<a name="l00195"></a>00195 <span class="keyword">struct </span>_rtdm_getsockopt_args {
<a name="l00196"></a>00196         <span class="keywordtype">int</span> level;
<a name="l00197"></a>00197         <span class="keywordtype">int</span> optname;
<a name="l00198"></a>00198         <span class="keywordtype">void</span> *optval;
<a name="l00199"></a>00199         socklen_t *optlen;
<a name="l00200"></a>00200 };
<a name="l00201"></a>00201 
<a name="l00202"></a>00202 <span class="keyword">struct </span>_rtdm_setsockopt_args {
<a name="l00203"></a>00203         <span class="keywordtype">int</span> level;
<a name="l00204"></a>00204         <span class="keywordtype">int</span> optname;
<a name="l00205"></a>00205         <span class="keyword">const</span> <span class="keywordtype">void</span> *optval;
<a name="l00206"></a>00206         socklen_t optlen;
<a name="l00207"></a>00207 };
<a name="l00208"></a>00208 
<a name="l00209"></a>00209 <span class="keyword">struct </span>_rtdm_getsockaddr_args {
<a name="l00210"></a>00210         <span class="keyword">struct </span>sockaddr *addr;
<a name="l00211"></a>00211         socklen_t *addrlen;
<a name="l00212"></a>00212 };
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 <span class="keyword">struct </span>_rtdm_setsockaddr_args {
<a name="l00215"></a>00215         <span class="keyword">const</span> <span class="keyword">struct </span>sockaddr *addr;
<a name="l00216"></a>00216         socklen_t addrlen;
<a name="l00217"></a>00217 };
<a name="l00218"></a>00218 
<a name="l00219"></a>00219 <span class="preprocessor">#define _RTIOC_GETSOCKOPT       _IOW(RTIOC_TYPE_COMMON, 0x20,           \</span>
<a name="l00220"></a>00220 <span class="preprocessor">                                     struct _rtdm_getsockopt_args)</span>
<a name="l00221"></a>00221 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_SETSOCKOPT       _IOW(RTIOC_TYPE_COMMON, 0x21,           \</span>
<a name="l00222"></a>00222 <span class="preprocessor">                                     struct _rtdm_setsockopt_args)</span>
<a name="l00223"></a>00223 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_BIND             _IOW(RTIOC_TYPE_COMMON, 0x22,           \</span>
<a name="l00224"></a>00224 <span class="preprocessor">                                     struct _rtdm_setsockaddr_args)</span>
<a name="l00225"></a>00225 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_CONNECT          _IOW(RTIOC_TYPE_COMMON, 0x23,           \</span>
<a name="l00226"></a>00226 <span class="preprocessor">                                     struct _rtdm_setsockaddr_args)</span>
<a name="l00227"></a>00227 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_LISTEN           _IOW(RTIOC_TYPE_COMMON, 0x24,           \</span>
<a name="l00228"></a>00228 <span class="preprocessor">                                     int)</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_ACCEPT           _IOW(RTIOC_TYPE_COMMON, 0x25,           \</span>
<a name="l00230"></a>00230 <span class="preprocessor">                                     struct _rtdm_getsockaddr_args)</span>
<a name="l00231"></a>00231 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_GETSOCKNAME      _IOW(RTIOC_TYPE_COMMON, 0x26,           \</span>
<a name="l00232"></a>00232 <span class="preprocessor">                                     struct _rtdm_getsockaddr_args)</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_GETPEERNAME      _IOW(RTIOC_TYPE_COMMON, 0x27,           \</span>
<a name="l00234"></a>00234 <span class="preprocessor">                                     struct _rtdm_getsockaddr_args)</span>
<a name="l00235"></a>00235 <span class="preprocessor"></span><span class="preprocessor">#define _RTIOC_SHUTDOWN         _IOW(RTIOC_TYPE_COMMON, 0x28,           \</span>
<a name="l00236"></a>00236 <span class="preprocessor">                                     int)</span>
<a name="l00237"></a>00237 <span class="preprocessor"></span>
<a name="l00238"></a>00238 <span class="preprocessor">#ifdef __KERNEL__</span>
<a name="l00239"></a>00239 <span class="preprocessor"></span><span class="keywordtype">int</span> __rt_dev_open(rtdm_user_info_t *user_info, <span class="keyword">const</span> <span class="keywordtype">char</span> *path, <span class="keywordtype">int</span> oflag);
<a name="l00240"></a>00240 <span class="keywordtype">int</span> __rt_dev_socket(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> protocol_family,
<a name="l00241"></a>00241                     <span class="keywordtype">int</span> socket_type, <span class="keywordtype">int</span> protocol);
<a name="l00242"></a>00242 <span class="keywordtype">int</span> __rt_dev_close(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd);
<a name="l00243"></a>00243 <span class="keywordtype">int</span> __rt_dev_ioctl(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> request, ...);
<a name="l00244"></a>00244 ssize_t __rt_dev_read(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd, <span class="keywordtype">void</span> *buf,
<a name="l00245"></a>00245                       <span class="keywordtype">size_t</span> nbyte);
<a name="l00246"></a>00246 ssize_t __rt_dev_write(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf,
<a name="l00247"></a>00247                        <span class="keywordtype">size_t</span> nbyte);
<a name="l00248"></a>00248 ssize_t __rt_dev_recvmsg(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd,
<a name="l00249"></a>00249                          <span class="keyword">struct</span> msghdr *msg, <span class="keywordtype">int</span> flags);
<a name="l00250"></a>00250 ssize_t __rt_dev_sendmsg(rtdm_user_info_t *user_info, <span class="keywordtype">int</span> fd,
<a name="l00251"></a>00251                          <span class="keyword">const</span> <span class="keyword">struct</span> msghdr *msg, <span class="keywordtype">int</span> flags);
<a name="l00252"></a>00252 <span class="preprocessor">#endif </span><span class="comment">/* __KERNEL__ */</span>
<a name="l00253"></a>00253 
<a name="l00254"></a>00254 <span class="comment">/* Define RTDM_NO_DEFAULT_USER_API to switch off the default rt_dev_xxx</span>
<a name="l00255"></a>00255 <span class="comment"> * interface when providing a customised user API */</span>
<a name="l00256"></a>00256 <span class="preprocessor">#ifndef RTDM_NO_DEFAULT_USER_API</span>
<a name="l00257"></a>00257 <span class="preprocessor"></span>
<a name="l00258"></a>00258 <span class="preprocessor">#ifdef __KERNEL__</span>
<a name="l00259"></a>00259 <span class="preprocessor"></span>
<a name="l00260"></a>00260 <span class="preprocessor">#define rt_dev_open(path, oflag, ...)                           \</span>
<a name="l00261"></a>00261 <span class="preprocessor">        __rt_dev_open(NULL, path, oflag)</span>
<a name="l00262"></a>00262 <span class="preprocessor"></span>
<a name="l00263"></a>00263 <span class="preprocessor">#define rt_dev_socket(protocol_family, socket_type, protocol)   \</span>
<a name="l00264"></a>00264 <span class="preprocessor">        __rt_dev_socket(NULL, protocol_family, socket_type, protocol)</span>
<a name="l00265"></a>00265 <span class="preprocessor"></span>
<a name="l00266"></a>00266 <span class="preprocessor">#define rt_dev_close(fd)                                        \</span>
<a name="l00267"></a>00267 <span class="preprocessor">        __rt_dev_close(NULL, fd)</span>
<a name="l00268"></a>00268 <span class="preprocessor"></span>
<a name="l00269"></a>00269 <span class="preprocessor">#define rt_dev_ioctl(fd, request, ...)                          \</span>
<a name="l00270"></a>00270 <span class="preprocessor">        __rt_dev_ioctl(NULL, fd, request, __VA_ARGS__)</span>
<a name="l00271"></a>00271 <span class="preprocessor"></span>
<a name="l00272"></a>00272 <span class="preprocessor">#define rt_dev_read(fd, buf, nbyte)                             \</span>
<a name="l00273"></a>00273 <span class="preprocessor">        __rt_dev_read(NULL, fd, buf, nbyte)</span>
<a name="l00274"></a>00274 <span class="preprocessor"></span>
<a name="l00275"></a>00275 <span class="preprocessor">#define rt_dev_write(fd, buf, nbyte)                            \</span>
<a name="l00276"></a>00276 <span class="preprocessor">        __rt_dev_write(NULL, fd, buf, nbyte)</span>
<a name="l00277"></a>00277 <span class="preprocessor"></span>
<a name="l00278"></a>00278 <span class="preprocessor">#define rt_dev_recvmsg(fd, msg, flags)                          \</span>
<a name="l00279"></a>00279 <span class="preprocessor">        __rt_dev_recvmsg(NULL, fd, msg, flags)</span>
<a name="l00280"></a>00280 <span class="preprocessor"></span>
<a name="l00281"></a>00281 <span class="preprocessor">#define rt_dev_sendmsg(fd, msg, flags)                          \</span>
<a name="l00282"></a>00282 <span class="preprocessor">        __rt_dev_sendmsg(NULL, fd, msg, flags)</span>
<a name="l00283"></a>00283 <span class="preprocessor"></span>
<a name="l00284"></a>00284 <span class="keyword">static</span> <span class="keyword">inline</span> ssize_t <a class="code" href="group__userapi.html#g0cc144457c649f197d485581686273dd" title="Receive message from socket.">rt_dev_recvfrom</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> len, <span class="keywordtype">int</span> flags,
<a name="l00285"></a>00285                                       <span class="keyword">struct</span> sockaddr *from,
<a name="l00286"></a>00286                                       socklen_t *fromlen)
<a name="l00287"></a>00287 {
<a name="l00288"></a>00288         <span class="keyword">struct </span>iovec iov;
<a name="l00289"></a>00289         <span class="keyword">struct </span>msghdr msg;
<a name="l00290"></a>00290         <span class="keywordtype">int</span> ret;
<a name="l00291"></a>00291 
<a name="l00292"></a>00292         iov.iov_base = buf;
<a name="l00293"></a>00293         iov.iov_len = len;
<a name="l00294"></a>00294 
<a name="l00295"></a>00295         msg.msg_name = from;
<a name="l00296"></a>00296         msg.msg_namelen = from ? *fromlen : 0;
<a name="l00297"></a>00297         msg.msg_iov = &amp;iov;
<a name="l00298"></a>00298         msg.msg_iovlen = 1;
<a name="l00299"></a>00299         msg.msg_control = NULL;
<a name="l00300"></a>00300         msg.msg_controllen = 0;
<a name="l00301"></a>00301 
<a name="l00302"></a>00302         ret = <a class="code" href="group__userapi.html#gcea5109e178100cdecaa9053c64632d1" title="Receive message from socket.">rt_dev_recvmsg</a>(fd, &amp;msg, flags);
<a name="l00303"></a>00303         <span class="keywordflow">if</span> (ret &gt;= 0 &amp;&amp; from)
<a name="l00304"></a>00304                 *fromlen = msg.msg_namelen;
<a name="l00305"></a>00305         <span class="keywordflow">return</span> ret;
<a name="l00306"></a>00306 }
<a name="l00307"></a>00307 
<a name="l00308"></a>00308 <span class="preprocessor">#else </span><span class="comment">/* !__KERNEL__ */</span>
<a name="l00309"></a>00309 
<a name="l00310"></a>00310 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00311"></a>00311 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00312"></a>00312 <span class="preprocessor">#endif</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span>
<a name="l00314"></a>00314 <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g4a76768928826e715850196e34db6d1a" title="Open a device.">rt_dev_open</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <span class="keywordtype">int</span> oflag, ...);
<a name="l00315"></a>00315 <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g95cfb4d81e3faf578015cad5750b22a3" title="Create a socket.">rt_dev_socket</a>(<span class="keywordtype">int</span> protocol_family, <span class="keywordtype">int</span> socket_type, <span class="keywordtype">int</span> protocol);
<a name="l00316"></a>00316 <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#ga34c1ddf4e2deb727a1ab3cd648ce5d9" title="Close a device or socket.">rt_dev_close</a>(<span class="keywordtype">int</span> fd);
<a name="l00317"></a>00317 <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> request, ...);
<a name="l00318"></a>00318 ssize_t <a class="code" href="group__userapi.html#g89c490849c0e1879ae672a23b84a1eda" title="Read from device.">rt_dev_read</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> nbyte);
<a name="l00319"></a>00319 ssize_t <a class="code" href="group__userapi.html#ge966625748b547779bb8c5385e7fb2aa" title="Write to device.">rt_dev_write</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> nbyte);
<a name="l00320"></a>00320 ssize_t <a class="code" href="group__userapi.html#gcea5109e178100cdecaa9053c64632d1" title="Receive message from socket.">rt_dev_recvmsg</a>(<span class="keywordtype">int</span> fd, <span class="keyword">struct</span> msghdr *msg, <span class="keywordtype">int</span> flags);
<a name="l00321"></a>00321 ssize_t <a class="code" href="group__userapi.html#g751340ba2f9be0b6a514c73f760561b3" title="Transmit message to socket.">rt_dev_sendmsg</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keyword">struct</span> msghdr *msg, <span class="keywordtype">int</span> flags);
<a name="l00322"></a>00322 
<a name="l00323"></a>00323 ssize_t <a class="code" href="group__userapi.html#g0cc144457c649f197d485581686273dd" title="Receive message from socket.">rt_dev_recvfrom</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> len, <span class="keywordtype">int</span> flags,
<a name="l00324"></a>00324                         <span class="keyword">struct</span> sockaddr *from, socklen_t *fromlen);
<a name="l00325"></a>00325 
<a name="l00326"></a>00326 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00327"></a>00327 <span class="preprocessor"></span>}
<a name="l00328"></a>00328 <span class="preprocessor">#endif</span>
<a name="l00329"></a>00329 <span class="preprocessor"></span>
<a name="l00330"></a>00330 <span class="preprocessor">#endif </span><span class="comment">/* !__KERNEL__ */</span>
<a name="l00331"></a>00331 
<a name="l00332"></a>00332 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00333"></a>00333 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00334"></a>00334 <span class="preprocessor">#endif</span>
<a name="l00335"></a>00335 <span class="preprocessor"></span>
<a name="l00336"></a>00336 <span class="keyword">static</span> <span class="keyword">inline</span> ssize_t <a class="code" href="group__userapi.html#g57c712a42db215de74f0cdf42936450d" title="Receive message from socket.">rt_dev_recv</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> len, <span class="keywordtype">int</span> flags)
<a name="l00337"></a>00337 {
<a name="l00338"></a>00338         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g0cc144457c649f197d485581686273dd" title="Receive message from socket.">rt_dev_recvfrom</a>(fd, buf, len, flags, NULL, NULL);
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340 
<a name="l00341"></a>00341 <span class="keyword">static</span> <span class="keyword">inline</span> ssize_t <a class="code" href="group__userapi.html#g6a3a39ea1a35258935a32e1870955269" title="Transmit message to socket.">rt_dev_sendto</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> len,
<a name="l00342"></a>00342                                     <span class="keywordtype">int</span> flags, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *to,
<a name="l00343"></a>00343                                     socklen_t tolen)
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345         <span class="keyword">struct </span>iovec iov;
<a name="l00346"></a>00346         <span class="keyword">struct </span>msghdr msg;
<a name="l00347"></a>00347 
<a name="l00348"></a>00348         iov.iov_base = (<span class="keywordtype">void</span> *)buf;
<a name="l00349"></a>00349         iov.iov_len = len;
<a name="l00350"></a>00350 
<a name="l00351"></a>00351         msg.msg_name = (<span class="keyword">struct </span>sockaddr *)to;
<a name="l00352"></a>00352         msg.msg_namelen = tolen;
<a name="l00353"></a>00353         msg.msg_iov = &amp;iov;
<a name="l00354"></a>00354         msg.msg_iovlen = 1;
<a name="l00355"></a>00355         msg.msg_control = NULL;
<a name="l00356"></a>00356         msg.msg_controllen = 0;
<a name="l00357"></a>00357 
<a name="l00358"></a>00358         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g751340ba2f9be0b6a514c73f760561b3" title="Transmit message to socket.">rt_dev_sendmsg</a>(fd, &amp;msg, flags);
<a name="l00359"></a>00359 }
<a name="l00360"></a>00360 
<a name="l00361"></a>00361 <span class="keyword">static</span> <span class="keyword">inline</span> ssize_t <a class="code" href="group__userapi.html#g8e6eeb1cc9924ed11f3f457d4153697d" title="Transmit message to socket.">rt_dev_send</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> len,
<a name="l00362"></a>00362                                   <span class="keywordtype">int</span> flags)
<a name="l00363"></a>00363 {
<a name="l00364"></a>00364         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g6a3a39ea1a35258935a32e1870955269" title="Transmit message to socket.">rt_dev_sendto</a>(fd, buf, len, flags, NULL, 0);
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366 
<a name="l00367"></a>00367 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g4ebcc7a2e18eec6697a4db7bd699d5d7" title="Get socket option.">rt_dev_getsockopt</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> level, <span class="keywordtype">int</span> optname,
<a name="l00368"></a>00368                                     <span class="keywordtype">void</span> *optval, socklen_t *optlen)
<a name="l00369"></a>00369 {
<a name="l00370"></a>00370         <span class="keyword">struct </span>_rtdm_getsockopt_args args =
<a name="l00371"></a>00371                 { level, optname, optval, optlen };
<a name="l00372"></a>00372 
<a name="l00373"></a>00373         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_GETSOCKOPT, &amp;args);
<a name="l00374"></a>00374 }
<a name="l00375"></a>00375 
<a name="l00376"></a>00376 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#gada2561361357285840c5b054fe20681" title="Set socket option.">rt_dev_setsockopt</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> level, <span class="keywordtype">int</span> optname,
<a name="l00377"></a>00377                                     <span class="keyword">const</span> <span class="keywordtype">void</span> *optval, socklen_t optlen)
<a name="l00378"></a>00378 {
<a name="l00379"></a>00379         <span class="keyword">struct </span>_rtdm_setsockopt_args args =
<a name="l00380"></a>00380                 { level, optname, (<span class="keywordtype">void</span> *)optval, optlen };
<a name="l00381"></a>00381 
<a name="l00382"></a>00382         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_SETSOCKOPT, &amp;args);
<a name="l00383"></a>00383 }
<a name="l00384"></a>00384 
<a name="l00385"></a>00385 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g5442e4f8737560e3294bd5bab61ad3fd" title="Bind to local address.">rt_dev_bind</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *my_addr,
<a name="l00386"></a>00386                               socklen_t addrlen)
<a name="l00387"></a>00387 {
<a name="l00388"></a>00388         <span class="keyword">struct </span>_rtdm_setsockaddr_args args = { my_addr, addrlen };
<a name="l00389"></a>00389 
<a name="l00390"></a>00390         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_BIND, &amp;args);
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392 
<a name="l00393"></a>00393 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g122e2d5dd89478cd6c85d4cea0f91099" title="Connect to remote address.">rt_dev_connect</a>(<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *serv_addr,
<a name="l00394"></a>00394                                  socklen_t addrlen)
<a name="l00395"></a>00395 {
<a name="l00396"></a>00396         <span class="keyword">struct </span>_rtdm_setsockaddr_args args = { serv_addr, addrlen };
<a name="l00397"></a>00397 
<a name="l00398"></a>00398         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_CONNECT, &amp;args);
<a name="l00399"></a>00399 }
<a name="l00400"></a>00400 
<a name="l00401"></a>00401 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g0fe0e2ce5bf5f23733c5dd6b068fbbd4" title="Listen for incomming connection requests.">rt_dev_listen</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> backlog)
<a name="l00402"></a>00402 {
<a name="l00403"></a>00403         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_LISTEN, backlog);
<a name="l00404"></a>00404 }
<a name="l00405"></a>00405 
<a name="l00406"></a>00406 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#gf6072f0befa5df3fc1ab89529756fa6f" title="Accept a connection requests.">rt_dev_accept</a>(<span class="keywordtype">int</span> fd, <span class="keyword">struct</span> sockaddr *addr,
<a name="l00407"></a>00407                                 socklen_t *addrlen)
<a name="l00408"></a>00408 {
<a name="l00409"></a>00409         <span class="keyword">struct </span>_rtdm_getsockaddr_args args = { addr, addrlen };
<a name="l00410"></a>00410 
<a name="l00411"></a>00411         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_ACCEPT, &amp;args);
<a name="l00412"></a>00412 }
<a name="l00413"></a>00413 
<a name="l00414"></a>00414 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#g8cd0e12cde039b13ed4e195009859a68" title="Get local socket address.">rt_dev_getsockname</a>(<span class="keywordtype">int</span> fd, <span class="keyword">struct</span> sockaddr *name,
<a name="l00415"></a>00415                                      socklen_t *namelen)
<a name="l00416"></a>00416 {
<a name="l00417"></a>00417         <span class="keyword">struct </span>_rtdm_getsockaddr_args args = { name, namelen };
<a name="l00418"></a>00418 
<a name="l00419"></a>00419         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_GETSOCKNAME, &amp;args);
<a name="l00420"></a>00420 }
<a name="l00421"></a>00421 
<a name="l00422"></a>00422 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#gf8820904f66c985fff36ab16f2d88c0d" title="Get socket destination address.">rt_dev_getpeername</a>(<span class="keywordtype">int</span> fd, <span class="keyword">struct</span> sockaddr *name,
<a name="l00423"></a>00423                                      socklen_t *namelen)
<a name="l00424"></a>00424 {
<a name="l00425"></a>00425         <span class="keyword">struct </span>_rtdm_getsockaddr_args args = { name, namelen };
<a name="l00426"></a>00426 
<a name="l00427"></a>00427         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_GETPEERNAME, &amp;args);
<a name="l00428"></a>00428 }
<a name="l00429"></a>00429 
<a name="l00430"></a>00430 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__userapi.html#gcf4718e173241ee16a2d01e2a9b4fb94" title="Shut down parts of a connection.">rt_dev_shutdown</a>(<span class="keywordtype">int</span> fd, <span class="keywordtype">int</span> how)
<a name="l00431"></a>00431 {
<a name="l00432"></a>00432         <span class="keywordflow">return</span> <a class="code" href="group__userapi.html#g72b69315a44f235b05627a0c257c01f4" title="Issue an IOCTL.">rt_dev_ioctl</a>(fd, _RTIOC_SHUTDOWN, how);
<a name="l00433"></a>00433 }
<a name="l00434"></a>00434 
<a name="l00435"></a>00435 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00436"></a>00436 <span class="preprocessor"></span>}
<a name="l00437"></a>00437 <span class="preprocessor">#endif</span>
<a name="l00438"></a>00438 <span class="preprocessor"></span>
<a name="l00439"></a>00439 <span class="preprocessor">#endif </span><span class="comment">/* RTDM_NO_DEFAULT_USER_API */</span>
<a name="l00440"></a>00440 
<a name="l00441"></a>00441 <span class="preprocessor">#endif </span><span class="comment">/* _RTDM_H */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:36 2010 for Xenomai API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>