Changeset c69d327 in mainline


Ignore:
Timestamp:
2010-10-08T21:32:49Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
368fb2c
Parents:
0a866eeb
Message:

Move the common packet interface to libc.

Location:
uspace
Files:
2 added
2 deleted
42 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r0a866eeb rc69d327  
    101101        generic/net/inet.c \
    102102        generic/net/modules.c \
     103        generic/net/packet.c \
    103104        generic/net/socket_client.c \
    104105        generic/net/socket_parse.c \
  • uspace/lib/c/include/net/packet_header.h

    r0a866eeb rc69d327  
    2727 */
    2828
    29 /** @addtogroup packet
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  Packet header.
     34 * Packet header.
    3535 */
    3636
    37 #ifndef __NET_PACKET_HEADER_H__
    38 #define __NET_PACKET_HEADER_H__
     37#ifndef LIBC_PACKET_HEADER_H_
     38#define LIBC_PACKET_HEADER_H_
    3939
    40 #include <packet/packet.h>
     40#include <net/packet.h>
    4141
    4242/** Returns the actual packet data length.
    43  *  @param[in] header The packet header.
     43 * @param[in] header    The packet header.
    4444 */
    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)
    4647
    4748/** Returns the maximum packet address length.
    48  *  @param[in] header The packet header.
     49 * @param[in] header    The packet header.
    4950 */
    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)
    5153
    5254/** Returns the minimum packet suffix.
    53  *  @param[in] header The packet header.
     55 *  @param[in] header   The packet header.
    5456 */
    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)
    5659
    57 /** Packet integrity check magic value.
    58  */
     60/** Packet integrity check magic value. */
    5961#define PACKET_MAGIC_VALUE      0x11227788
    6062
    61 /** Packet header.
    62  */
    63 struct packet{
    64         /** Packet identifier.
    65          */
     63/** Packet header. */
     64struct packet {
     65        /** Packet identifier. */
    6666        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.
    6971         */
    7072        size_t order;
    71         /** Packet metric.
    72         */
     73
     74        /** Packet metric. */
    7375        size_t metric;
    74         /** Previous packet in the queue.
    75          */
     76        /** Previous packet in the queue. */
    7677        packet_id_t previous;
    77         /** Next packet in the queue.
    78          */
     78        /** Next packet in the queue. */
    7979        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.
    8385         */
    8486        size_t length;
    85         /** Stored source and destination addresses length.
    86         */
     87
     88        /** Stored source and destination addresses length. */
    8789        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.
    8994         */
    9095        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.
    92100         */
    93101        size_t dest_addr;
    94         /** Reserved data prefix length in bytes.
    95         */
     102
     103        /** Reserved data prefix length in bytes. */
    96104        size_t max_prefix;
    97         /** Reserved content length in bytes.
    98          */
     105        /** Reserved content length in bytes. */
    99106        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.
    101111         */
    102112        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.
    104117         */
    105118        size_t data_end;
    106         /** Integrity check magic value.
    107         */
     119
     120        /** Integrity check magic value. */
    108121        int magic_value;
    109122};
    110123
    111124/** 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.
    115129 */
    116 static inline int packet_is_valid(const packet_t packet){
     130static inline int packet_is_valid(const packet_t packet)
     131{
    117132        return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
    118133}
  • uspace/lib/net/generic/packet_client.c

    r0a866eeb rc69d327  
    4444
    4545#include <net_messages.h>
    46 #include <packet/packet.h>
    47 #include <packet/packet_header.h>
     46#include <net/packet.h>
     47#include <net/packet_header.h>
    4848
    4949int packet_copy_data(packet_t packet, const void * data, size_t length)
  • uspace/lib/net/generic/packet_remote.c

    r0a866eeb rc69d327  
    4747#include <packet_remote.h>
    4848
    49 #include <packet/packet.h>
    50 #include <packet/packet_header.h>
     49#include <net/packet.h>
     50#include <net/packet_header.h>
    5151
    5252/** Obtain the packet from the packet server as the shared memory block.
  • uspace/lib/net/generic/socket_core.c

    r0a866eeb rc69d327  
    4646#include <adt/dynamic_fifo.h>
    4747#include <adt/int_map.h>
    48 #include <packet/packet.h>
     48#include <net/packet.h>
    4949#include <packet_client.h>
    5050#include <packet_remote.h>
  • uspace/lib/net/il/ip_client.c

    r0a866eeb rc69d327  
    4343#include <ip_header.h>
    4444
    45 #include <packet/packet.h>
     45#include <net/packet.h>
    4646
    4747size_t ip_client_header_length(packet_t packet){
  • uspace/lib/net/include/icmp_client.h

    r0a866eeb rc69d327  
    3939
    4040#include <icmp_codes.h>
    41 #include <packet/packet.h>
     41#include <net/packet.h>
    4242
    4343/** Processes the received packet prefixed with an ICMP header.
  • uspace/lib/net/include/icmp_interface.h

    r0a866eeb rc69d327  
    3939#include <net_device.h>
    4040#include <adt/measured_strings.h>
    41 #include <packet/packet.h>
     41#include <net/packet.h>
    4242#include <net/inet.h>
    4343#include <ip_codes.h>
  • uspace/lib/net/include/il_interface.h

    r0a866eeb rc69d327  
    4545#include <net_messages.h>
    4646#include <net_device.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <packet_client.h>
    4949#include <il_messages.h>
  • uspace/lib/net/include/ip_client.h

    r0a866eeb rc69d327  
    4141#include <sys/types.h>
    4242
    43 #include <packet/packet.h>
     43#include <net/packet.h>
    4444#include <ip_codes.h>
    4545#include <ip_interface.h>
  • uspace/lib/net/include/ip_interface.h

    r0a866eeb rc69d327  
    3939
    4040#include <net_device.h>
    41 #include <packet/packet.h>
     41#include <net/packet.h>
    4242
    4343#include <net/in.h>
  • uspace/lib/net/include/netif_local.h

    r0a866eeb rc69d327  
    4848#include <adt/measured_strings.h>
    4949#include <net_device.h>
    50 #include <packet/packet.h>
     50#include <net/packet.h>
    5151
    5252/** Network interface device specific data.
  • uspace/lib/net/include/nil_interface.h

    r0a866eeb rc69d327  
    4141#include <net_messages.h>
    4242#include <adt/measured_strings.h>
    43 #include <packet/packet.h>
     43#include <net/packet.h>
    4444#include <nil_messages.h>
    4545#include <net_device.h>
  • uspace/lib/net/include/packet_client.h

    r0a866eeb rc69d327  
    4545#define __NET_PACKET_CLIENT_H__
    4646
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848
    4949/** @name Packet client interface
  • uspace/lib/net/include/packet_remote.h

    r0a866eeb rc69d327  
    3434#define __NET_PACKET_REMOTE_H__
    3535
    36 #include <packet/packet.h>
     36#include <net/packet.h>
    3737
    3838extern int packet_translate_remote(int, packet_ref, packet_id_t);
  • uspace/lib/net/include/tl_common.h

    r0a866eeb rc69d327  
    3939
    4040#include <net/socket_codes.h>
    41 
    42 #include <packet/packet.h>
     41#include <net/packet.h>
    4342#include <net_device.h>
    4443#include <net/inet.h>
  • uspace/lib/net/include/tl_interface.h

    r0a866eeb rc69d327  
    4343#include <net_messages.h>
    4444#include <net_device.h>
    45 #include <packet/packet.h>
     45#include <net/packet.h>
    4646#include <packet_client.h>
    4747#include <tl_messages.h>
  • uspace/lib/net/netif/netif_local.c

    r0a866eeb rc69d327  
    4646#include <net_messages.h>
    4747#include <net/modules.h>
    48 #include <packet/packet.h>
     48#include <net/packet.h>
    4949#include <packet_client.h>
    5050#include <packet/packet_server.h>
  • uspace/lib/net/netif/netif_nil_bundle.c

    r0a866eeb rc69d327  
    4040#include <ipc/net.h>
    4141
    42 #include <packet/packet.h>
     42#include <net/packet.h>
    4343#include <netif_nil_bundle.h>
    4444#include <netif_local.h>
  • uspace/lib/net/netif/netif_remote.c

    r0a866eeb rc69d327  
    3939#include <net/modules.h>
    4040#include <adt/measured_strings.h>
    41 #include <packet/packet.h>
     41#include <net/packet.h>
    4242#include <packet_client.h>
    4343#include <net_device.h>
  • uspace/lib/net/nil/nil_remote.c

    r0a866eeb rc69d327  
    3939#include <net_device.h>
    4040#include <nil_interface.h>
    41 #include <packet/packet.h>
     41#include <net/packet.h>
    4242#include <packet_client.h>
    4343#include <nil_messages.h>
  • uspace/lib/net/tl/icmp_client.c

    r0a866eeb rc69d327  
    4545#include <icmp_codes.h>
    4646#include <icmp_client.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <packet_client.h>
    4949#include <icmp_header.h>
  • uspace/lib/net/tl/tl_common.c

    r0a866eeb rc69d327  
    4545#include <err.h>
    4646
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <packet_client.h>
    4949#include <packet_remote.h>
  • uspace/lib/socket/Makefile

    r0a866eeb rc69d327  
    3535        generic/icmp_common.c \
    3636        generic/icmp_api.c \
    37         packet/packet.c \
    38         packet/packet_server.c
     37        packet/packet_server.c
    3938
    4039include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/socket/include/icmp_api.h

    r0a866eeb rc69d327  
    4444#include <net_device.h>
    4545#include <adt/measured_strings.h>
    46 #include <packet/packet.h>
     46#include <net/packet.h>
    4747#include <ip_codes.h>
    4848#include <icmp_codes.h>
  • uspace/lib/socket/include/net_messages.h

    r0a866eeb rc69d327  
    4444#include <net_device.h>
    4545#include <adt/measured_strings.h>
    46 #include <packet/packet.h>
     46#include <net/packet.h>
    4747
    4848/** @name Networking specific message arguments definitions
  • uspace/lib/socket/include/packet/packet_local.h

    r0a866eeb rc69d327  
    3737#define __NET_PACKET_LOCAL_H__
    3838
    39 #include <packet/packet.h>
     39#include <net/packet.h>
    4040
    4141/** @name Packet local interface
  • uspace/lib/socket/include/socket_core.h

    r0a866eeb rc69d327  
    4545#include <adt/dynamic_fifo.h>
    4646#include <adt/int_map.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848
    4949/** Initial size of the received packet queue.
  • uspace/lib/socket/packet/packet_server.c

    r0a866eeb rc69d327  
    4646#include <ipc/ipc.h>
    4747#include <ipc/packet.h>
     48#include <net/packet.h>
     49#include <net/packet_header.h>
     50#include <packet/packet_server.h>
    4851
    4952#include <net_messages.h>
    50 #include <packet/packet.h>
    5153#include <packet/packet_local.h>
    52 #include <packet/packet_header.h>
    53 #include <packet/packet_server.h>
    5454
    5555#define FREE_QUEUES_COUNT       7
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r0a866eeb rc69d327  
    3838
    3939#include <netif_local.h>
    40 #include <packet/packet.h>
     40#include <net/packet.h>
    4141#include <packet_client.h>
    4242
  • uspace/srv/hw/netif/dp8390/dp8390.h

    r0a866eeb rc69d327  
    3636#define __NET_NETIF_DP8390_H__
    3737
    38 #include <packet/packet.h>
     38#include <net/packet.h>
    3939
    4040#include "dp8390_port.h"
  • uspace/srv/net/il/arp/arp.c

    r0a866eeb rc69d327  
    5555#include <protocol_map.h>
    5656#include <adt/measured_strings.h>
    57 #include <packet/packet.h>
     57#include <net/packet.h>
    5858#include <packet_client.h>
    5959#include <packet_remote.h>
  • uspace/srv/net/il/arp/arp_module.c

    r0a866eeb rc69d327  
    4747#include <net/modules.h>
    4848#include <net_interface.h>
    49 #include <packet/packet.h>
     49#include <net/packet.h>
    5050#include <il_local.h>
    5151
  • uspace/srv/net/il/ip/ip_module.c

    r0a866eeb rc69d327  
    4646#include <net/modules.h>
    4747#include <net_interface.h>
    48 #include <packet/packet.h>
     48#include <net/packet.h>
    4949#include <il_local.h>
    5050
  • uspace/srv/net/net/net.c

    r0a866eeb rc69d327  
    5454#include <adt/measured_strings.h>
    5555#include <adt/module_map.h>
    56 #include <packet/packet.h>
     56#include <net/packet.h>
    5757#include <il_messages.h>
    5858#include <netif_remote.h>
  • uspace/srv/net/net/net.h

    r0a866eeb rc69d327  
    4646#include <adt/measured_strings.h>
    4747#include <adt/module_map.h>
    48 #include <packet/packet.h>
     48#include <net/packet.h>
    4949
    5050/** @name Modules definitions
  • uspace/srv/net/nil/eth/eth_module.c

    r0a866eeb rc69d327  
    4545#include <net/modules.h>
    4646#include <net_interface.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <nil_local.h>
    4949
  • uspace/srv/net/nil/nildummy/nildummy.c

    r0a866eeb rc69d327  
    5252#include <il_interface.h>
    5353#include <adt/measured_strings.h>
    54 #include <packet/packet.h>
     54#include <net/packet.h>
    5555#include <packet_remote.h>
    5656#include <nil_local.h>
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r0a866eeb rc69d327  
    4545#include <net/modules.h>
    4646#include <net_interface.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <nil_local.h>
    4949
  • uspace/srv/net/tl/icmp/icmp_module.c

    r0a866eeb rc69d327  
    4545
    4646#include <net/modules.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <net_interface.h>
    4949#include <tl_local.h>
  • uspace/srv/net/tl/tcp/tcp.h

    r0a866eeb rc69d327  
    4040#include <fibril_synch.h>
    4141
    42 #include <packet/packet.h>
     42#include <net/packet.h>
    4343#include <net_device.h>
    4444#include <socket_core.h>
  • uspace/srv/net/tl/tcp/tcp_module.c

    r0a866eeb rc69d327  
    4747#include <net/modules.h>
    4848
    49 #include <packet/packet.h>
     49#include <net/packet.h>
    5050#include <net_interface.h>
    5151#include <ip_interface.h>
  • uspace/srv/net/tl/udp/udp_module.c

    r0a866eeb rc69d327  
    4545
    4646#include <net/modules.h>
    47 #include <packet/packet.h>
     47#include <net/packet.h>
    4848#include <net_interface.h>
    4949#include <tl_local.h>
Note: See TracChangeset for help on using the changeset viewer.