Changeset ae972834 in mainline for uspace/lib
- Timestamp:
- 2010-10-08T21:47:40Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b278b4e
- Parents:
- c0e74b1 (diff), 368fb2c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 3 added
- 2 deleted
- 27 edited
- 6 moved
-
c/Makefile (modified) (1 diff)
-
c/generic/net/packet.c (added)
-
c/include/ipc/packet.h (moved) (moved from uspace/lib/socket/include/packet/packet_messages.h ) (2 diffs)
-
c/include/net/packet.h (added)
-
c/include/net/packet_header.h (moved) (moved from uspace/lib/socket/include/packet/packet_header.h ) (1 diff)
-
net/Makefile (modified) (1 diff)
-
net/generic/packet_client.c (moved) (moved from uspace/lib/socket/packet/packet_client.c ) (3 diffs)
-
net/generic/packet_remote.c (modified) (1 diff)
-
net/generic/socket_core.c (moved) (moved from uspace/lib/socket/generic/socket_core.c ) (2 diffs)
-
net/il/ip_client.c (modified) (1 diff)
-
net/il/ip_remote.c (modified) (1 diff)
-
net/include/icmp_client.h (modified) (1 diff)
-
net/include/icmp_interface.h (modified) (1 diff)
-
net/include/il_interface.h (modified) (1 diff)
-
net/include/ip_client.h (modified) (1 diff)
-
net/include/ip_interface.h (modified) (1 diff)
-
net/include/netif_interface.h (modified) (1 diff)
-
net/include/netif_local.h (modified) (1 diff)
-
net/include/nil_interface.h (modified) (1 diff)
-
net/include/packet_client.h (moved) (moved from uspace/lib/socket/include/packet/packet_client.h ) (5 diffs)
-
net/include/packet_remote.h (modified) (1 diff)
-
net/include/socket_core.h (moved) (moved from uspace/lib/socket/include/socket_core.h ) (1 diff)
-
net/include/tl_common.h (modified) (1 diff)
-
net/include/tl_interface.h (modified) (1 diff)
-
net/netif/netif_local.c (modified) (1 diff)
-
net/netif/netif_nil_bundle.c (modified) (1 diff)
-
net/netif/netif_remote.c (modified) (1 diff)
-
net/nil/nil_remote.c (modified) (1 diff)
-
net/tl/icmp_client.c (modified) (1 diff)
-
net/tl/icmp_remote.c (modified) (1 diff)
-
net/tl/tl_common.c (modified) (1 diff)
-
socket/Makefile (modified) (1 diff)
-
socket/include/icmp_api.h (modified) (1 diff)
-
socket/include/net_messages.h (modified) (1 diff)
-
socket/include/packet/packet.h (deleted)
-
socket/include/packet/packet_local.h (added)
-
socket/packet/packet.c (deleted)
-
socket/packet/packet_server.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rc0e74b1 rae972834 101 101 generic/net/inet.c \ 102 102 generic/net/modules.c \ 103 generic/net/packet.c \ 103 104 generic/net/socket_client.c \ 104 105 generic/net/socket_parse.c \ -
uspace/lib/c/include/ipc/packet.h
rc0e74b1 rae972834 27 27 */ 28 28 29 /** @addtogroup packet29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_PACKET_MESSAGES__38 #define __NET_PACKET_MESSAGES__37 #ifndef LIBC_PACKET_MESSAGES_ 38 #define LIBC_PACKET_MESSAGES_ 39 39 40 40 #include <ipc/ipc.h> 41 41 #include <ipc/net.h> 42 42 43 /** Packet server module messages. 44 */ 43 /** Packet server module messages. */ 45 44 typedef enum { 46 45 /** Create packet message with specified content length. 47 * @see packet_get_1()46 * @see packet_get_1() 48 47 */ 49 48 NET_PACKET_CREATE_1 = NET_PACKET_FIRST, 50 /** Create packet message with specified address length, prefix, content and suffix. 51 * @see packet_get_4() 49 50 /** 51 * Create packet message with specified address length, prefix, content 52 * and suffix. 53 * @see packet_get_4() 52 54 */ 53 55 NET_PACKET_CREATE_4, 56 54 57 /** Get packet message. 55 * @see packet_return() 56 */ 58 * @see packet_return() */ 57 59 NET_PACKET_GET, 60 58 61 /** Get packet size message. 59 * @see packet_translate()62 * @see packet_translate() 60 63 */ 61 64 NET_PACKET_GET_SIZE, 65 62 66 /** Release packet message. 63 * @see pq_release()67 * @see pq_release() 64 68 */ 65 69 NET_PACKET_RELEASE 66 70 } packet_messages; 67 71 68 /** Returns the protocol service message parameter. 69 */ 70 #define ARP_GET_PROTO(call) (services_t) IPC_GET_ARG2(*call) 72 /** Returns the protocol service message parameter. */ 73 #define ARP_GET_PROTO(call) (services_t) IPC_GET_ARG2(*call) 71 74 72 /** Returns the packet identifier message parameter. 73 */ 74 #define IPC_GET_ID(call) (packet_id_t) IPC_GET_ARG1(*call) 75 /** Returns the packet identifier message parameter. */ 76 #define IPC_GET_ID(call) (packet_id_t) IPC_GET_ARG1(*call) 75 77 76 /** Returns the maximal content length message parameter. 77 */ 78 #define IPC_GET_CONTENT(call) (size_t) IPC_GET_ARG1(*call) 78 /** Returns the maximal content length message parameter. */ 79 #define IPC_GET_CONTENT(call) (size_t) IPC_GET_ARG1(*call) 79 80 80 /** Returns the maximal address length message parameter. 81 */ 81 /** Returns the maximal address length message parameter. */ 82 82 #define IPC_GET_ADDR_LEN(call) (size_t) IPC_GET_ARG2(*call) 83 83 84 /** Returns the maximal prefix length message parameter. 85 */ 86 #define IPC_GET_PREFIX(call) (size_t) IPC_GET_ARG3(*call) 84 /** Returns the maximal prefix length message parameter. */ 85 #define IPC_GET_PREFIX(call) (size_t) IPC_GET_ARG3(*call) 87 86 88 /** Returns the maximal suffix length message parameter. 89 */ 90 #define IPC_GET_SUFFIX(call) (size_t) IPC_GET_ARG4(*call) 87 /** Returns the maximal suffix length message parameter. */ 88 #define IPC_GET_SUFFIX(call) (size_t) IPC_GET_ARG4(*call) 91 89 92 90 #endif -
uspace/lib/c/include/net/packet_header.h
rc0e74b1 rae972834 27 27 */ 28 28 29 /** @addtogroup packet29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Packet header.34 * Packet header. 35 35 */ 36 36 37 #ifndef __NET_PACKET_HEADER_H__38 #define __NET_PACKET_HEADER_H__37 #ifndef LIBC_PACKET_HEADER_H_ 38 #define LIBC_PACKET_HEADER_H_ 39 39 40 #include < packet/packet.h>40 #include <net/packet.h> 41 41 42 42 /** Returns the actual packet data length. 43 * @param[in] headerThe packet header.43 * @param[in] header The packet header. 44 44 */ 45 #define PACKET_DATA_LENGTH(header) ((header)->data_end - (header)->data_start) 45 #define PACKET_DATA_LENGTH(header) \ 46 ((header)->data_end - (header)->data_start) 46 47 47 48 /** Returns the maximum packet address length. 48 * @param[in] headerThe packet header.49 * @param[in] header The packet header. 49 50 */ 50 #define PACKET_MAX_ADDRESS_LENGTH(header) ((header)->dest_addr - (header)->src_addr) 51 #define PACKET_MAX_ADDRESS_LENGTH(header) \ 52 ((header)->dest_addr - (header)->src_addr) 51 53 52 54 /** Returns the minimum packet suffix. 53 * @param[in] header The packet header.55 * @param[in] header The packet header. 54 56 */ 55 #define PACKET_MIN_SUFFIX(header) ((header)->length - (header)->data_start - (header)->max_content) 57 #define PACKET_MIN_SUFFIX(header) \ 58 ((header)->length - (header)->data_start - (header)->max_content) 56 59 57 /** Packet integrity check magic value. 58 */ 60 /** Packet integrity check magic value. */ 59 61 #define PACKET_MAGIC_VALUE 0x11227788 60 62 61 /** Packet header. 62 */ 63 struct packet{ 64 /** Packet identifier. 65 */ 63 /** Packet header. */ 64 struct packet { 65 /** Packet identifier. */ 66 66 packet_id_t packet_id; 67 /** Packet queue sorting value. 68 * The packet queue is sorted the ascending order. 67 68 /** 69 * Packet queue sorting value. 70 * The packet queue is sorted the ascending order. 69 71 */ 70 72 size_t order; 71 /** Packet metric. 72 */73 74 /** Packet metric. */ 73 75 size_t metric; 74 /** Previous packet in the queue. 75 */ 76 /** Previous packet in the queue. */ 76 77 packet_id_t previous; 77 /** Next packet in the queue. 78 */ 78 /** Next packet in the queue. */ 79 79 packet_id_t next; 80 /** Total length of the packet. 81 * Contains the header, the addresses and the data of the packet. 82 * Corresponds to the mapped sharable memory block. 80 81 /** 82 * Total length of the packet. 83 * Contains the header, the addresses and the data of the packet. 84 * Corresponds to the mapped sharable memory block. 83 85 */ 84 86 size_t length; 85 /** Stored source and destination addresses length. 86 */87 88 /** Stored source and destination addresses length. */ 87 89 size_t addr_len; 88 /** Souce address offset in bytes from the beginning of the packet header. 90 91 /** 92 * Souce address offset in bytes from the beginning of the packet 93 * header. 89 94 */ 90 95 size_t src_addr; 91 /** Destination address offset in bytes from the beginning of the packet header. 96 97 /** 98 * Destination address offset in bytes from the beginning of the packet 99 * header. 92 100 */ 93 101 size_t dest_addr; 94 /** Reserved data prefix length in bytes. 95 */102 103 /** Reserved data prefix length in bytes. */ 96 104 size_t max_prefix; 97 /** Reserved content length in bytes. 98 */ 105 /** Reserved content length in bytes. */ 99 106 size_t max_content; 100 /** Actual data start offset in bytes from the beginning of the packet header. 107 108 /** 109 * Actual data start offset in bytes from the beginning of the packet 110 * header. 101 111 */ 102 112 size_t data_start; 103 /** Actual data end offset in bytes from the beginning of the packet header. 113 114 /** 115 * Actual data end offset in bytes from the beginning of the packet 116 * header. 104 117 */ 105 118 size_t data_end; 106 /** Integrity check magic value. 107 */119 120 /** Integrity check magic value. */ 108 121 int magic_value; 109 122 }; 110 123 111 124 /** Returns whether the packet is valid. 112 * @param[in] packet The packet to be checked. 113 * @returns true if the packet is not NULL and the magic value is correct. 114 * @returns false otherwise. 125 * @param[in] packet The packet to be checked. 126 * @returns True if the packet is not NULL and the magic value is 127 * correct. 128 * @returns False otherwise. 115 129 */ 116 static inline int packet_is_valid(const packet_t packet){ 130 static inline int packet_is_valid(const packet_t packet) 131 { 117 132 return packet && (packet->magic_value == PACKET_MAGIC_VALUE); 118 133 } -
uspace/lib/net/Makefile
rc0e74b1 rae972834 35 35 generic/net_remote.c \ 36 36 generic/net_checksum.c \ 37 generic/packet_client.c \ 37 38 generic/packet_remote.c \ 39 generic/socket_core.c \ 38 40 adt/module_map.c \ 39 41 netif/netif_local.c \ -
uspace/lib/net/generic/packet_client.c
rc0e74b1 rae972834 41 41 #include <sys/mman.h> 42 42 43 #include <packet_client.h> 44 43 45 #include <net_messages.h> 44 #include <packet/packet.h> 45 #include <packet/packet_header.h> 46 #include <packet/packet_client.h> 46 #include <net/packet.h> 47 #include <net/packet_header.h> 47 48 48 49 int packet_copy_data(packet_t packet, const void * data, size_t length) … … 181 182 182 183 // get a new packet 183 copy = packet_get_4_ local(phone, PACKET_DATA_LENGTH(packet),184 copy = packet_get_4_remote(phone, PACKET_DATA_LENGTH(packet), 184 185 PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, 185 186 PACKET_MIN_SUFFIX(packet)); … … 199 200 return copy; 200 201 } else { 201 pq_release_ local(phone, copy->packet_id);202 pq_release_remote(phone, copy->packet_id); 202 203 return NULL; 203 204 } -
uspace/lib/net/generic/packet_remote.c
rc0e74b1 rae972834 40 40 #include <err.h> 41 41 #include <ipc/ipc.h> 42 #include <ipc/packet.h> 42 43 #include <sys/mman.h> 43 44 44 45 #include <net_messages.h> 45 #include <packet/packet.h> 46 #include <packet/packet_client.h> 47 #include <packet/packet_header.h> 48 #include <packet/packet_messages.h> 46 #include <packet_client.h> 49 47 #include <packet_remote.h> 48 49 #include <net/packet.h> 50 #include <net/packet_header.h> 50 51 51 52 /** Obtain the packet from the packet server as the shared memory block. -
uspace/lib/net/generic/socket_core.c
rc0e74b1 rae972834 46 46 #include <adt/dynamic_fifo.h> 47 47 #include <adt/int_map.h> 48 #include <packet/packet.h> 49 #include <packet/packet_client.h> 48 #include <net/packet.h> 49 #include <packet_client.h> 50 #include <packet_remote.h> 50 51 #include <net/modules.h> 51 52 #include <socket_core.h> … … 91 92 // release all received packets 92 93 while((packet_id = dyn_fifo_pop(&socket->received)) >= 0){ 93 pq_release_ local(packet_phone, packet_id);94 pq_release_remote(packet_phone, packet_id); 94 95 } 95 96 dyn_fifo_destroy(&socket->received); -
uspace/lib/net/il/ip_client.c
rc0e74b1 rae972834 40 40 41 41 #include <ip_client.h> 42 #include <packet/packet.h> 43 #include <packet/packet_client.h> 42 #include <packet_client.h> 44 43 #include <ip_header.h> 44 45 #include <net/packet.h> 45 46 46 47 size_t ip_client_header_length(packet_t packet){ -
uspace/lib/net/il/ip_remote.c
rc0e74b1 rae972834 47 47 #include <net/inet.h> 48 48 #include <ip_interface.h> 49 #include <packet /packet_client.h>49 #include <packet_client.h> 50 50 #include <il_messages.h> 51 51 #include <ip_messages.h> -
uspace/lib/net/include/icmp_client.h
rc0e74b1 rae972834 39 39 40 40 #include <icmp_codes.h> 41 #include < packet/packet.h>41 #include <net/packet.h> 42 42 43 43 /** Processes the received packet prefixed with an ICMP header. -
uspace/lib/net/include/icmp_interface.h
rc0e74b1 rae972834 39 39 #include <net_device.h> 40 40 #include <adt/measured_strings.h> 41 #include < packet/packet.h>41 #include <net/packet.h> 42 42 #include <net/inet.h> 43 43 #include <ip_codes.h> -
uspace/lib/net/include/il_interface.h
rc0e74b1 rae972834 45 45 #include <net_messages.h> 46 46 #include <net_device.h> 47 #include < packet/packet.h>48 #include <packet /packet_client.h>47 #include <net/packet.h> 48 #include <packet_client.h> 49 49 #include <il_messages.h> 50 50 -
uspace/lib/net/include/ip_client.h
rc0e74b1 rae972834 41 41 #include <sys/types.h> 42 42 43 #include < packet/packet.h>43 #include <net/packet.h> 44 44 #include <ip_codes.h> 45 45 #include <ip_interface.h> -
uspace/lib/net/include/ip_interface.h
rc0e74b1 rae972834 39 39 40 40 #include <net_device.h> 41 #include < packet/packet.h>41 #include <net/packet.h> 42 42 43 43 #include <net/in.h> -
uspace/lib/net/include/netif_interface.h
rc0e74b1 rae972834 53 53 54 54 #include <netif_remote.h> 55 #include <packet /packet_client.h>55 #include <packet_client.h> 56 56 57 57 #define netif_module_message netif_module_message_standalone -
uspace/lib/net/include/netif_local.h
rc0e74b1 rae972834 48 48 #include <adt/measured_strings.h> 49 49 #include <net_device.h> 50 #include < packet/packet.h>50 #include <net/packet.h> 51 51 52 52 /** Network interface device specific data. -
uspace/lib/net/include/nil_interface.h
rc0e74b1 rae972834 41 41 #include <net_messages.h> 42 42 #include <adt/measured_strings.h> 43 #include < packet/packet.h>43 #include <net/packet.h> 44 44 #include <nil_messages.h> 45 45 #include <net_device.h> -
uspace/lib/net/include/packet_client.h
rc0e74b1 rae972834 45 45 #define __NET_PACKET_CLIENT_H__ 46 46 47 #include < packet/packet.h>47 #include <net/packet.h> 48 48 49 49 /** @name Packet client interface … … 172 172 * @returns Other error codes as defined for the packet_return() function. 173 173 */ 174 extern int packet_translate_ local(int phone, packet_ref packet, packet_id_t packet_id);174 extern int packet_translate_remote(int phone, packet_ref packet, packet_id_t packet_id); 175 175 176 176 /** Obtains the packet of the given dimensions. … … 184 184 * @returns NULL on error. 185 185 */ 186 extern packet_t packet_get_4_ local(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);186 extern packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix); 187 187 188 188 /** Obtains the packet of the given content size. … … 193 193 * @returns NULL on error. 194 194 */ 195 extern packet_t packet_get_1_ local(int phone, size_t content);195 extern packet_t packet_get_1_remote(int phone, size_t content); 196 196 197 197 /** Releases the packet queue. … … 202 202 * @param[in] packet_id The packet identifier. 203 203 */ 204 extern void pq_release_ local(int phone, packet_id_t packet_id);204 extern void pq_release_remote(int phone, packet_id_t packet_id); 205 205 206 206 /** Returns the packet copy. -
uspace/lib/net/include/packet_remote.h
rc0e74b1 rae972834 34 34 #define __NET_PACKET_REMOTE_H__ 35 35 36 #include < packet/packet.h>36 #include <net/packet.h> 37 37 38 38 extern int packet_translate_remote(int, packet_ref, packet_id_t); -
uspace/lib/net/include/socket_core.h
rc0e74b1 rae972834 45 45 #include <adt/dynamic_fifo.h> 46 46 #include <adt/int_map.h> 47 #include < packet/packet.h>47 #include <net/packet.h> 48 48 49 49 /** Initial size of the received packet queue. -
uspace/lib/net/include/tl_common.h
rc0e74b1 rae972834 39 39 40 40 #include <net/socket_codes.h> 41 42 #include <packet/packet.h> 41 #include <net/packet.h> 43 42 #include <net_device.h> 44 43 #include <net/inet.h> -
uspace/lib/net/include/tl_interface.h
rc0e74b1 rae972834 43 43 #include <net_messages.h> 44 44 #include <net_device.h> 45 #include < packet/packet.h>46 #include <packet /packet_client.h>45 #include <net/packet.h> 46 #include <packet_client.h> 47 47 #include <tl_messages.h> 48 48 -
uspace/lib/net/netif/netif_local.c
rc0e74b1 rae972834 46 46 #include <net_messages.h> 47 47 #include <net/modules.h> 48 #include < packet/packet.h>49 #include <packet /packet_client.h>48 #include <net/packet.h> 49 #include <packet_client.h> 50 50 #include <packet/packet_server.h> 51 51 #include <packet_remote.h> -
uspace/lib/net/netif/netif_nil_bundle.c
rc0e74b1 rae972834 40 40 #include <ipc/net.h> 41 41 42 #include < packet/packet.h>42 #include <net/packet.h> 43 43 #include <netif_nil_bundle.h> 44 44 #include <netif_local.h> -
uspace/lib/net/netif/netif_remote.c
rc0e74b1 rae972834 39 39 #include <net/modules.h> 40 40 #include <adt/measured_strings.h> 41 #include < packet/packet.h>42 #include <packet /packet_client.h>41 #include <net/packet.h> 42 #include <packet_client.h> 43 43 #include <net_device.h> 44 44 #include <netif_remote.h> -
uspace/lib/net/nil/nil_remote.c
rc0e74b1 rae972834 39 39 #include <net_device.h> 40 40 #include <nil_interface.h> 41 #include < packet/packet.h>42 #include <packet /packet_client.h>41 #include <net/packet.h> 42 #include <packet_client.h> 43 43 #include <nil_messages.h> 44 44 #include <nil_remote.h> -
uspace/lib/net/tl/icmp_client.c
rc0e74b1 rae972834 45 45 #include <icmp_codes.h> 46 46 #include <icmp_client.h> 47 #include < packet/packet.h>48 #include <packet /packet_client.h>47 #include <net/packet.h> 48 #include <packet_client.h> 49 49 #include <icmp_header.h> 50 50 -
uspace/lib/net/tl/icmp_remote.c
rc0e74b1 rae972834 45 45 #include <net/modules.h> 46 46 #include <icmp_interface.h> 47 #include <packet /packet_client.h>47 #include <packet_client.h> 48 48 #include <icmp_messages.h> 49 49 -
uspace/lib/net/tl/tl_common.c
rc0e74b1 rae972834 45 45 #include <err.h> 46 46 47 #include < packet/packet.h>48 #include <packet /packet_client.h>47 #include <net/packet.h> 48 #include <packet_client.h> 49 49 #include <packet_remote.h> 50 50 #include <net_device.h> -
uspace/lib/socket/Makefile
rc0e74b1 rae972834 33 33 34 34 SOURCES = \ 35 generic/socket_core.c \36 35 generic/icmp_common.c \ 37 36 generic/icmp_api.c \ 38 packet/packet.c \ 39 packet/packet_client.c \ 40 packet/packet_server.c 37 packet/packet_server.c 41 38 42 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/socket/include/icmp_api.h
rc0e74b1 rae972834 44 44 #include <net_device.h> 45 45 #include <adt/measured_strings.h> 46 #include < packet/packet.h>46 #include <net/packet.h> 47 47 #include <ip_codes.h> 48 48 #include <icmp_codes.h> -
uspace/lib/socket/include/net_messages.h
rc0e74b1 rae972834 44 44 #include <net_device.h> 45 45 #include <adt/measured_strings.h> 46 #include < packet/packet.h>46 #include <net/packet.h> 47 47 48 48 /** @name Networking specific message arguments definitions -
uspace/lib/socket/packet/packet_server.c
rc0e74b1 rae972834 42 42 #include <fibril_synch.h> 43 43 #include <unistd.h> 44 #include <sys/mman.h> 44 45 45 46 #include <ipc/ipc.h> 46 #include <sys/mman.h> 47 #include <ipc/packet.h> 48 #include <net/packet.h> 49 #include <net/packet_header.h> 50 #include <packet/packet_server.h> 47 51 48 52 #include <net_messages.h> 49 #include <packet/packet.h> 50 #include <packet/packet_client.h> 51 #include <packet/packet_header.h> 52 #include <packet/packet_messages.h> 53 #include <packet/packet_server.h> 53 #include <packet/packet_local.h> 54 54 55 55 #define FREE_QUEUES_COUNT 7
Note:
See TracChangeset
for help on using the changeset viewer.
