source: mainline/uspace/srv/net/socket/socket_messages.h@ 6092b56e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 6092b56e was 6092b56e, checked in by Jakub Jermar <jakub@…>, 15 years ago

Fix dangerous type casts.

  • Property mode set to 100644
File size: 5.6 KB
RevLine 
[21580dd]1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup socket
30 * @{
31 */
32
33/** @file
34 * Socket messages.
35 * @see socket.h
36 */
37
38
39#ifndef __NET_SOCKET_MESSAGES_H__
40#define __NET_SOCKET_MESSAGES_H__
41
42#include <ipc/ipc.h>
43
44#include "../messages.h"
45
46#include "../include/socket_codes.h"
47
48/** Socket client messages.
49 */
50typedef enum{
51 /** Creates a new socket.
52 * @see socket()
53 */
54 NET_SOCKET = NET_SOCKET_FIRST,
55 /** Binds the socket.
56 * @see bind()
57 */
58 NET_SOCKET_BIND,
59 /** Creates a new socket.
60 * @see socket()
61 */
62 NET_SOCKET_LISTEN,
63 /** Accepts an incomming connection.
64 * @see accept()
65 */
66 NET_SOCKET_ACCEPT,
67 /** Connects the socket.
68 * @see connect()
69 */
70 NET_SOCKET_CONNECT,
71 /** Closes the socket.
72 * @see closesocket()
73 */
74 NET_SOCKET_CLOSE,
75 /** Sends data via the stream socket.
76 * @see send()
77 */
78 NET_SOCKET_SEND,
79 /** Sends data via the datagram socket.
80 * @see sendto()
81 */
82 NET_SOCKET_SENDTO,
83 /** Receives data from the stream socket.
84 * @see socket()
85 */
86 NET_SOCKET_RECV,
87 /** Receives data from the datagram socket.
88 * @see socket()
89 */
90 NET_SOCKET_RECVFROM,
91 /** Gets the socket option.
92 * @see getsockopt()
93 */
94 NET_SOCKET_GETSOCKOPT,
95 /** Sets the socket option.
96 * @see setsockopt()
97 */
98 NET_SOCKET_SETSOCKOPT,
99 /** New socket for acceptence notification message.
100 */
101 NET_SOCKET_ACCEPTED,
102 /** New data received notification message.
103 */
104 NET_SOCKET_RECEIVED,
105 /** New socket data fragment size notification message.
106 */
107 NET_SOCKET_DATA_FRAGMENT_SIZE
108} socket_messages;
109
110/** @name Socket specific message parameters definitions
111 */
112/*@{*/
113
114/** Sets the socket identifier in the message answer.
115 * @param[out] answer The message answer structure.
116 */
[6092b56e]117#define SOCKET_SET_SOCKET_ID(answer) &IPC_GET_ARG1(answer)
[21580dd]118
119/** Returns the socket identifier message parameter.
120 * @param[in] call The message call structure.
121 */
[6092b56e]122#define SOCKET_GET_SOCKET_ID(call) (int) IPC_GET_ARG1(call)
[21580dd]123
124/** Sets the read data length in the message answer.
125 * @param[out] answer The message answer structure.
126 */
[6092b56e]127#define SOCKET_SET_READ_DATA_LENGTH(answer) &IPC_GET_ARG1(answer)
[21580dd]128
129/** Returns the read data length message parameter.
130 * @param[in] call The message call structure.
131 */
[6092b56e]132#define SOCKET_GET_READ_DATA_LENGTH(call) (int) IPC_GET_ARG1(call)
[21580dd]133
134/** Returns the backlog message parameter.
135 * @param[in] call The message call structure.
136 */
[6092b56e]137#define SOCKET_GET_BACKLOG(call) (int) IPC_GET_ARG2(call)
[21580dd]138
139/** Returns the option level message parameter.
140 * @param[in] call The message call structure.
141 */
[6092b56e]142#define SOCKET_GET_OPT_LEVEL(call) (int) IPC_GET_ARG2(call)
[21580dd]143
144/** Returns the data fragment size message parameter.
145 * @param[in] call The message call structure.
146 */
[aadf01e]147#define SOCKET_GET_DATA_FRAGMENT_SIZE(call) (size_t) IPC_GET_ARG2(call)
[21580dd]148
149/** Sets the data fragment size in the message answer.
150 * @param[out] answer The message answer structure.
151 */
[6092b56e]152#define SOCKET_SET_DATA_FRAGMENT_SIZE(answer) &IPC_GET_ARG2(answer)
[21580dd]153
[ede63e4]154/** Sets the address length in the message answer.
155 * @param[out] answer The message answer structure.
156 */
[6092b56e]157#define SOCKET_SET_ADDRESS_LENGTH(answer) &IPC_GET_ARG3(answer)
[ede63e4]158
159/** Returns the address length message parameter.
160 * @param[in] call The message call structure.
161 */
[aadf01e]162#define SOCKET_GET_ADDRESS_LENGTH(call) (socklen_t) IPC_GET_ARG3(call)
[ede63e4]163
[21580dd]164/** Sets the header size in the message answer.
165 * @param[out] answer The message answer structure.
166 */
[6092b56e]167#define SOCKET_SET_HEADER_SIZE(answer) &IPC_GET_ARG3(answer)
[21580dd]168
169/** Returns the header size message parameter.
170 * @param[in] call The message call structure.
171 */
[6092b56e]172#define SOCKET_GET_HEADER_SIZE(call) (size_t) IPC_GET_ARG3(call)
[21580dd]173
174/** Returns the flags message parameter.
175 * @param[in] call The message call structure.
176 */
[6092b56e]177#define SOCKET_GET_FLAGS(call) (int) IPC_GET_ARG4(call)
[21580dd]178
179/** Returns the option name message parameter.
180 * @param[in] call The message call structure.
181 */
[6092b56e]182#define SOCKET_GET_OPT_NAME(call) (int) IPC_GET_ARG4(call)
[21580dd]183
184/** Returns the data fragments message parameter.
185 * @param[in] call The message call structure.
186 */
[aadf01e]187#define SOCKET_GET_DATA_FRAGMENTS(call) (int) IPC_GET_ARG5(call)
[21580dd]188
189/** Returns the new socket identifier message parameter.
190 * @param[in] call The message call structure.
191 */
[aadf01e]192#define SOCKET_GET_NEW_SOCKET_ID(call) (int) IPC_GET_ARG5(call)
[21580dd]193
194/*@}*/
195
196#endif
197
198/** @}
199 */
Note: See TracBrowser for help on using the repository browser.