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