Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4743 | Rev 4756 | ||
---|---|---|---|
Line 119... | Line 119... | ||
119 | /** DIX Ethernet mode flag. |
119 | /** DIX Ethernet mode flag. |
120 | */ |
120 | */ |
121 | #define ETH_DIX ( 1 << ETH_MODE_SHIFT ) |
121 | #define ETH_DIX ( 1 << ETH_MODE_SHIFT ) |
122 | 122 | ||
123 | /** Returns whether the DIX Ethernet mode flag is set. |
123 | /** Returns whether the DIX Ethernet mode flag is set. |
124 | * @param flags The ethernet flags. Input parameter. |
124 | * @param[in] flags The ethernet flags. |
125 | * @see ETH_DIX |
125 | * @see ETH_DIX |
126 | */ |
126 | */ |
127 | #define IS_DIX( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_DIX ) |
127 | #define IS_DIX( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_DIX ) |
128 | 128 | ||
129 | /** 802.3 + 802.2 + LSAP mode flag. |
129 | /** 802.3 + 802.2 + LSAP mode flag. |
130 | */ |
130 | */ |
131 | #define ETH_8023_2_LSAP ( 2 << ETH_MODE_SHIFT ) |
131 | #define ETH_8023_2_LSAP ( 2 << ETH_MODE_SHIFT ) |
132 | 132 | ||
133 | /** Returns whether the 802.3 + 802.2 + LSAP mode flag is set. |
133 | /** Returns whether the 802.3 + 802.2 + LSAP mode flag is set. |
134 | * @param flags The ethernet flags. Input parameter. |
134 | * @param[in] flags The ethernet flags. |
135 | * @see ETH_8023_2_LSAP |
135 | * @see ETH_8023_2_LSAP |
136 | */ |
136 | */ |
137 | #define IS_8023_2_LSAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_LSAP ) |
137 | #define IS_8023_2_LSAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_LSAP ) |
138 | 138 | ||
139 | /** 802.3 + 802.2 + LSAP + SNAP mode flag. |
139 | /** 802.3 + 802.2 + LSAP + SNAP mode flag. |
140 | */ |
140 | */ |
141 | #define ETH_8023_2_SNAP ( 3 << ETH_MODE_SHIFT ) |
141 | #define ETH_8023_2_SNAP ( 3 << ETH_MODE_SHIFT ) |
142 | 142 | ||
143 | /** Returns whether the 802.3 + 802.2 + LSAP + SNAP mode flag is set. |
143 | /** Returns whether the 802.3 + 802.2 + LSAP + SNAP mode flag is set. |
144 | * @param flags The ethernet flags. Input parameter. |
144 | * @param[in] flags The ethernet flags. |
145 | * @see ETH_8023_2_SNAP |
145 | * @see ETH_8023_2_SNAP |
146 | */ |
146 | */ |
147 | #define IS_8023_2_SNAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_SNAP ) |
147 | #define IS_8023_2_SNAP( flags ) ((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_SNAP ) |
148 | 148 | ||
149 | /** Type definition of the ethernet address type. |
149 | /** Type definition of the ethernet address type. |
Line 174... | Line 174... | ||
174 | /** @name Message processing functions |
174 | /** @name Message processing functions |
175 | */ |
175 | */ |
176 | /*@{*/ |
176 | /*@{*/ |
177 | 177 | ||
178 | /** Processes IPC messages from the registered device driver modules in an infinite loop. |
178 | /** Processes IPC messages from the registered device driver modules in an infinite loop. |
179 | * @param iid The message identifier. Input parameter. |
179 | * @param[in] iid The message identifier. |
180 | * @param icall The message parameters. Input/output parameter. |
180 | * @param[in,out] icall The message parameters. |
181 | */ |
181 | */ |
182 | void eth_receiver( ipc_callid_t iid, ipc_call_t * icall ); |
182 | void eth_receiver( ipc_callid_t iid, ipc_call_t * icall ); |
183 | 183 | ||
184 | /** Registers new device or updates the MTU of an existing one. |
184 | /** Registers new device or updates the MTU of an existing one. |
185 | * Determines the device local hardware address. |
185 | * Determines the device local hardware address. |
186 | * @param device_id The new device identifier. Input parameter. |
186 | * @param[in] device_id The new device identifier. |
187 | * @param service The device driver service. Input parameter. |
187 | * @param[in] service The device driver service. |
188 | * @param mtu The device maximum transmission unit. Input parameter. |
188 | * @param[in] mtu The device maximum transmission unit. |
189 | * @returns EOK on success. |
189 | * @returns EOK on success. |
190 | * @returns EEXIST if the device with the different service exists. |
190 | * @returns EEXIST if the device with the different service exists. |
191 | * @returns ENOMEM if there is not enough memory left. |
191 | * @returns ENOMEM if there is not enough memory left. |
192 | * @returns Other error codes as defined for the net_get_device_conf_req() function. |
192 | * @returns Other error codes as defined for the net_get_device_conf_req() function. |
193 | * @returns Other error codes as defined for the netif_bind_service() function. |
193 | * @returns Other error codes as defined for the netif_bind_service() function. |
Line 195... | Line 195... | ||
195 | */ |
195 | */ |
196 | int eth_device_message( device_id_t device_id, services_t service, size_t mtu ); |
196 | int eth_device_message( device_id_t device_id, services_t service, size_t mtu ); |
197 | 197 | ||
198 | /** Registers receiving module service. |
198 | /** Registers receiving module service. |
199 | * Passes received packets for this service. |
199 | * Passes received packets for this service. |
200 | * @param service The module service. Input parameter. |
200 | * @param[in] service The module service. |
201 | * @param phone The service phone. Input parameter. |
201 | * @param[in] phone The service phone. |
202 | * @returns EOK on success. |
202 | * @returns EOK on success. |
203 | * @returns ENOENT if the service is not known. |
203 | * @returns ENOENT if the service is not known. |
204 | * @returns ENOMEM if there is not enough memory left. |
204 | * @returns ENOMEM if there is not enough memory left. |
205 | */ |
205 | */ |
206 | int eth_register_message( services_t service, int phone ); |
206 | int eth_register_message( services_t service, int phone ); |
207 | 207 | ||
208 | /** Returns the device packet dimensions for sending. |
208 | /** Returns the device packet dimensions for sending. |
209 | * @param device_id The device identifier. Input parameter. |
209 | * @param[in] device_id The device identifier. |
210 | * @param addr_len The minimum reserved address length. Output parameter. |
210 | * @param[out] addr_len The minimum reserved address length. |
211 | * @param prefix The minimum reserved prefix size. Output parameter. |
211 | * @param[out] prefix The minimum reserved prefix size. |
212 | * @param content The maximum content size. Output parameter. |
212 | * @param[out] content The maximum content size. |
213 | * @param suffix The minimum reserved suffix size. Output parameter. |
213 | * @param[out] suffix The minimum reserved suffix size. |
214 | * @returns EOK on success. |
214 | * @returns EOK on success. |
215 | * @returns EBADMEM if either one of the parameters is NULL. |
215 | * @returns EBADMEM if either one of the parameters is NULL. |
216 | * @returns ENOENT if there is no such device. |
216 | * @returns ENOENT if there is no such device. |
217 | */ |
217 | */ |
218 | int eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ); |
218 | int eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ); |
219 | 219 | ||
220 | /** Returns the device hardware address. |
220 | /** Returns the device hardware address. |
221 | * @param device_id The device identifier. Input parameter. |
221 | * @param[in] device_id The device identifier. |
222 | * @param type Type of the desired address. Input parameter |
222 | * @param[in] type Type of the desired address. |
223 | * @param address The device hardware address. Output parameter. |
223 | * @param[out] address The device hardware address. |
224 | * @returns EOK on success. |
224 | * @returns EOK on success. |
225 | * @returns EBADMEM if the address parameter is NULL. |
225 | * @returns EBADMEM if the address parameter is NULL. |
226 | * @returns ENOENT if there no such device. |
226 | * @returns ENOENT if there no such device. |
227 | */ |
227 | */ |
228 | int eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address ); |
228 | int eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address ); |
229 | 229 | ||
230 | /** Sends the packet queue. |
230 | /** Sends the packet queue. |
231 | * Sends only packet successfully processed by the eth_prepare_packet() function. |
231 | * Sends only packet successfully processed by the eth_prepare_packet() function. |
232 | * @param device_id The device identifier. Input parameter. |
232 | * @param[in] device_id The device identifier. |
233 | * @param packet The packet queue. Input parameter. |
233 | * @param[in] packet The packet queue. |
234 | * @param sender The sending module service. Input parameter. |
234 | * @param[in] sender The sending module service. |
235 | * @returns EOK on success. |
235 | * @returns EOK on success. |
236 | * @returns ENOENT if there no such device. |
236 | * @returns ENOENT if there no such device. |
237 | * @returns EINVAL if the service parameter is not known. |
237 | * @returns EINVAL if the service parameter is not known. |
238 | */ |
238 | */ |
239 | int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ); |
239 | int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ); |
240 | 240 | ||
241 | /*@}*/ |
241 | /*@}*/ |
242 | 242 | ||
243 | /** Processes the received packet and chooses the target registered module. |
243 | /** Processes the received packet and chooses the target registered module. |
244 | * @param flags The device flags. Input parameter. |
244 | * @param[in] flags The device flags. |
245 | * @param packet The packet. Input parameter. |
245 | * @param[in] packet The packet. |
246 | * @returns The target registered module. |
246 | * @returns The target registered module. |
247 | * @returns NULL if the packet is not long enough. |
247 | * @returns NULL if the packet is not long enough. |
248 | * @returns NULL if the packet is too long. |
248 | * @returns NULL if the packet is too long. |
249 | * @returns NULL if the raw ethernet protocol is used. |
249 | * @returns NULL if the raw ethernet protocol is used. |
250 | * @returns NULL if the dummy device FCS checksum is invalid. |
250 | * @returns NULL if the dummy device FCS checksum is invalid. |
251 | * @returns NULL if the packet address length is not big enough. |
251 | * @returns NULL if the packet address length is not big enough. |
252 | */ |
252 | */ |
253 | eth_proto_ref eth_process_packet( int flags, packet_t packet ); |
253 | eth_proto_ref eth_process_packet( int flags, packet_t packet ); |
254 | 254 | ||
255 | /** Prepares the packet for sending. |
255 | /** Prepares the packet for sending. |
256 | * @param flags The device flags. Input parameter. |
256 | * @param[in] flags The device flags. |
257 | * @param packet The packet. Input parameter. |
257 | * @param[in] packet The packet. |
258 | * @param src_addr The source hardware address. Input parameter. |
258 | * @param[in] src_addr The source hardware address. |
259 | * @param ethertype The ethernet protocol type. Input parameter. |
259 | * @param[in] ethertype The ethernet protocol type. |
260 | * @param mtu The device maximum transmission unit. Input parameter. |
260 | * @param[in] mtu The device maximum transmission unit. |
261 | * @returns EOK on success. |
261 | * @returns EOK on success. |
262 | * @returns EINVAL if the packet addresses length is not long enough. |
262 | * @returns EINVAL if the packet addresses length is not long enough. |
263 | * @returns EINVAL if the packet is bigger than the device MTU. |
263 | * @returns EINVAL if the packet is bigger than the device MTU. |
264 | * @returns ENOMEM if there is not enough memory in the packet. |
264 | * @returns ENOMEM if there is not enough memory in the packet. |
265 | */ |
265 | */ |