Changeset ecff3d9 in mainline for uspace/srv/inet/inet.c


Ignore:
Timestamp:
2012-02-01T22:06:05Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
59157eb
Parents:
c76e926
Message:

Implement inet client IPC communication. Fix bug in inet_init().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/inet/inet.c

    rc76e926 recff3d9  
    4444#include <loc.h>
    4545#include <stdio.h>
     46#include <stdlib.h>
    4647#include <sys/types.h>
    4748
     
    99100}
    100101
     102static void inet_get_srcaddr(inet_client_t *client, ipc_callid_t callid,
     103    ipc_call_t *call)
     104{
     105        log_msg(LVL_DEBUG, "inet_get_srcaddr()");
     106
     107        async_answer_0(callid, ENOTSUP);
     108}
     109
    101110static void inet_send(inet_client_t *client, ipc_callid_t callid,
    102111    ipc_call_t *call)
    103112{
     113        uint32_t src_ipv4;
     114        uint32_t dest_ipv4;
     115        uint8_t tos;
     116        uint8_t ttl;
     117        int df;
     118        void *data;
     119        size_t size;
     120        int rc;
     121
    104122        log_msg(LVL_DEBUG, "inet_send()");
     123
     124        src_ipv4 = IPC_GET_ARG1(*call);
     125        dest_ipv4 = IPC_GET_ARG2(*call);
     126        tos = IPC_GET_ARG3(*call);
     127        ttl = IPC_GET_ARG4(*call);
     128        df = IPC_GET_ARG5(*call);
     129
     130        (void)src_ipv4;
     131        (void)dest_ipv4;
     132        (void)tos;
     133        (void)ttl;
     134        (void)df;
     135
     136        rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
     137        if (rc != EOK) {
     138                async_answer_0(callid, rc);
     139                return;
     140        }
     141
     142        free(data);
    105143        async_answer_0(callid, ENOTSUP);
    106144}
     
    168206                        inet_callback_create(&client, callid, &call);
    169207                        break;
     208                case INET_GET_SRCADDR:
     209                        inet_get_srcaddr(&client, callid, &call);
     210                        break;
    170211                case INET_SEND:
    171212                        inet_send(&client, callid, &call);
     
    197238                return 1;
    198239
     240        printf(NAME ": Accepting connections.\n");
    199241        task_retval(0);
    200242        async_manager();
Note: See TracChangeset for help on using the changeset viewer.