Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/nil/eth/eth.c

    r4eca056 rfb04cba8  
    156156typedef enum eth_addr_type eth_addr_type_t;
    157157
     158/** Type definition of the ethernet address type pointer.
     159 * @see eth_addr_type
     160 */
     161typedef eth_addr_type_t *eth_addr_type_ref;
     162
    158163/** Ethernet address type. */
    159164enum eth_addr_type {
     
    173178{
    174179        int index;
    175         eth_proto_t *proto;
     180        eth_proto_ref proto;
    176181
    177182        fibril_rwlock_read_lock(&eth_globals.protos_lock);
     
    281286    size_t mtu)
    282287{
    283         eth_device_t *device;
     288        eth_device_ref device;
    284289        int index;
    285290        measured_string_t names[2] = {
     
    293298                }
    294299        };
    295         measured_string_t *configuration;
     300        measured_string_ref configuration;
    296301        size_t count = sizeof(names) / sizeof(measured_string_t);
    297302        char *data;
    298         eth_proto_t *proto;
     303        eth_proto_ref proto;
    299304        int rc;
    300305
     
    337342       
    338343        /* Create a new device */
    339         device = (eth_device_t *) malloc(sizeof(eth_device_t));
     344        device = (eth_device_ref) malloc(sizeof(eth_device_t));
    340345        if (!device)
    341346                return ENOMEM;
     
    429434 * @returns             NULL if the packet address length is not big enough.
    430435 */
    431 static eth_proto_t *eth_process_packet(int flags, packet_t packet)
    432 {
    433         eth_header_snap_t *header;
     436static eth_proto_ref eth_process_packet(int flags, packet_t packet)
     437{
     438        eth_header_snap_ref header;
    434439        size_t length;
    435440        eth_type_t type;
    436441        size_t prefix;
    437442        size_t suffix;
    438         eth_fcs_t *fcs;
     443        eth_fcs_ref fcs;
    439444        uint8_t *data;
    440445        int rc;
     
    449454       
    450455        data = packet_get_data(packet);
    451         header = (eth_header_snap_t *) data;
     456        header = (eth_header_snap_ref) data;
    452457        type = ntohs(header->header.ethertype);
    453458       
     
    456461                prefix = sizeof(eth_header_t);
    457462                suffix = 0;
    458                 fcs = (eth_fcs_t *) data + length - sizeof(eth_fcs_t);
     463                fcs = (eth_fcs_ref) data + length - sizeof(eth_fcs_t);
    459464                length -= sizeof(eth_fcs_t);
    460465        } else if(type <= ETH_MAX_CONTENT) {
     
    482487
    483488                suffix = (type < ETH_MIN_CONTENT) ? ETH_MIN_CONTENT - type : 0U;
    484                 fcs = (eth_fcs_t *) data + prefix + type + suffix;
     489                fcs = (eth_fcs_ref) data + prefix + type + suffix;
    485490                suffix += length - prefix - type;
    486491                length = prefix + type + suffix;
     
    511516    packet_t packet, services_t target)
    512517{
    513         eth_proto_t *proto;
     518        eth_proto_ref proto;
    514519        packet_t next;
    515         eth_device_t *device;
     520        eth_device_ref device;
    516521        int flags;
    517522
     
    559564    size_t *prefix, size_t *content, size_t *suffix)
    560565{
    561         eth_device_t *device;
     566        eth_device_ref device;
    562567
    563568        if (!addr_len || !prefix || !content || !suffix)
     
    591596 */
    592597static int eth_addr_message(device_id_t device_id, eth_addr_type_t type,
    593     measured_string_t **address)
    594 {
    595         eth_device_t *device;
     598    measured_string_ref *address)
     599{
     600        eth_device_ref device;
    596601
    597602        if (!address)
     
    626631static int eth_register_message(services_t service, int phone)
    627632{
    628         eth_proto_t *proto;
     633        eth_proto_ref proto;
    629634        int protocol;
    630635        int index;
     
    641646                return EOK;
    642647        } else {
    643                 proto = (eth_proto_t *) malloc(sizeof(eth_proto_t));
     648                proto = (eth_proto_ref) malloc(sizeof(eth_proto_t));
    644649                if (!proto) {
    645650                        fibril_rwlock_write_unlock(&eth_globals.protos_lock);
     
    683688    size_t mtu)
    684689{
    685         eth_header_snap_t *header;
    686         eth_header_lsap_t *header_lsap;
    687         eth_header_t *header_dix;
    688         eth_fcs_t *fcs;
     690        eth_header_snap_ref header;
     691        eth_header_lsap_ref header_lsap;
     692        eth_header_ref header_dix;
     693        eth_fcs_ref fcs;
    689694        uint8_t *src;
    690695        uint8_t *dest;
     
    692697        int i;
    693698        void *padding;
    694         eth_preamble_t *preamble;
     699        eth_preamble_ref preamble;
    695700
    696701        i = packet_get_addr(packet, &src, &dest);
     
    790795    services_t sender)
    791796{
    792         eth_device_t *device;
     797        eth_device_ref device;
    793798        packet_t next;
    794799        packet_t tmp;
     
    840845    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    841846{
    842         measured_string_t *address;
     847        measured_string_ref address;
    843848        packet_t packet;
    844849        size_t addrlen;
Note: See TracChangeset for help on using the changeset viewer.