Rev 4271 | Rev 4350 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4271 | Rev 4307 | ||
|---|---|---|---|
| Line 31... | Line 31... | ||
| 31 | */ |
31 | */ |
| 32 | 32 | ||
| 33 | /** @file |
33 | /** @file |
| 34 | */ |
34 | */ |
| 35 | 35 | ||
| 36 | #ifndef __NET_ARP_MESSAGES_H__ |
36 | #ifndef __NET_ARP_INTERFACE_H__ |
| 37 | #define __NET_ARP_MESSAGES_H__ |
37 | #define __NET_ARP_INTERFACE_H__ |
| 38 | - | ||
| 39 | #include <async.h> |
- | |
| 40 | #include <errno.h> |
- | |
| 41 | - | ||
| 42 | #include <ipc/ipc.h> |
- | |
| 43 | - | ||
| 44 | #include "../messages.h" |
- | |
| 45 | 38 | ||
| 46 | #include "../structures/measured_strings.h" |
39 | #include "../structures/measured_strings.h" |
| 47 | 40 | ||
| 48 | #include "device.h" |
41 | #include "device.h" |
| 49 | 42 | ||
| 50 | typedef enum{ |
- | |
| 51 | /* ( device_id, nil_service, proto ), measured_strings_send( proto_addr ) */ |
- | |
| 52 | NET_ARP_DEVICE = NET_ARP_FIRST, |
- | |
| 53 | /* ( device_id, protocol ), measured_strings_send( target ), measured_strings_return( translation ) */ |
- | |
| 54 | NET_ARP_TRANSLATE, |
- | |
| 55 | /* ( device_id ) */ |
- | |
| 56 | NET_ARP_CLEAR_DEVICE, |
- | |
| 57 | /* () */ |
- | |
| 58 | NET_ARP_CLEAN_CACHE, |
- | |
| 59 | } arp_messages; |
- | |
| 60 | - | ||
| 61 | static inline int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ); |
43 | int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ); |
| 62 | static inline int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ); |
44 | int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ); |
| 63 | static inline int arp_clear_device_req( int arp_phone, device_id_t device_id ); |
45 | int arp_clear_device_req( int arp_phone, device_id_t device_id ); |
| 64 | static inline int arp_clean_cache_req( int arp_phone ); |
46 | int arp_clean_cache_req( int arp_phone ); |
| 65 | - | ||
| 66 | #if ARP_BUNDLE |
- | |
| 67 | - | ||
| 68 | #include "../il/arp/arp_wrappers.h" |
- | |
| 69 | - | ||
| 70 | /** Returns the protocol service message parameter. |
- | |
| 71 | */ |
- | |
| 72 | #define ARP_GET_PROTO( call ) ( services_t ) IPC_GET_ARG2( * call ) |
- | |
| 73 | - | ||
| 74 | static inline int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ){ |
- | |
| 75 | return arp_device_wrapper( device_id, netif, protocol, address ); |
- | |
| 76 | } |
- | |
| 77 | - | ||
| 78 | static inline int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ){ |
- | |
| 79 | return arp_translate_wrapper( device_id, protocol, address, translation, data ); |
- | |
| 80 | } |
- | |
| 81 | - | ||
| 82 | static inline int arp_clear_device_req( int arp_phone, device_id_t device_id ){ |
- | |
| 83 | return arp_clear_device_wrapper( device_id ); |
47 | int arp_connect_module( services_t service ); |
| 84 | } |
- | |
| 85 | - | ||
| 86 | static inline int arp_clean_cache_req( int arp_phone ){ |
- | |
| 87 | return arp_clean_cache_wrapper(); |
- | |
| 88 | } |
- | |
| 89 | - | ||
| 90 | #else |
- | |
| 91 | - | ||
| 92 | static inline int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ){ |
- | |
| 93 | aid_t message_id; |
- | |
| 94 | ipcarg_t result; |
- | |
| 95 | - | ||
| 96 | message_id = async_send_3( arp_phone, NET_ARP_DEVICE, device_id, protocol, netif, NULL ); |
- | |
| 97 | measured_strings_send( arp_phone, address, 1 ); |
- | |
| 98 | async_wait_for( message_id, & result ); |
- | |
| 99 | return result; |
- | |
| 100 | } |
- | |
| 101 | - | ||
| 102 | static inline int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ){ |
- | |
| 103 | aid_t message_id; |
48 | int arp_task_get_id( void ); |
| 104 | ipcarg_t result; |
- | |
| 105 | int string; |
- | |
| 106 | - | ||
| 107 | if( !( address && data )) return EBADMEM; |
- | |
| 108 | message_id = async_send_2( arp_phone, NET_ARP_TRANSLATE, device_id, protocol, NULL ); |
- | |
| 109 | measured_strings_send( arp_phone, address, 1 ); |
- | |
| 110 | string = measured_strings_return( arp_phone, translation, data, 1 ); |
- | |
| 111 | async_wait_for( message_id, & result ); |
- | |
| 112 | if(( string == EOK ) && ( result != EOK )){ |
- | |
| 113 | free( * translation ); |
- | |
| 114 | free( * data ); |
- | |
| 115 | } |
- | |
| 116 | return result; |
- | |
| 117 | } |
- | |
| 118 | - | ||
| 119 | static inline int arp_clear_device_req( int arp_phone, device_id_t device_id ){ |
- | |
| 120 | return async_req_1_0( arp_phone, NET_ARP_CLEAR_DEVICE, device_id ); |
- | |
| 121 | } |
- | |
| 122 | - | ||
| 123 | static inline int arp_clean_cache_req( int arp_phone ){ |
- | |
| 124 | return async_req_0_0( arp_phone, NET_ARP_CLEAN_CACHE ); |
- | |
| 125 | } |
- | |
| 126 | - | ||
| 127 | #endif |
- | |
| 128 | 49 | ||
| 129 | #endif |
50 | #endif |
| 130 | 51 | ||
| 131 | /** @} |
52 | /** @} |
| 132 | */ |
53 | */ |