Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0e25780 in mainline


Ignore:
Timestamp:
2012-03-07T21:01:10Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
45aa22c
Parents:
3d016ac
Message:

Inetcfg skeleton.

Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r3d016ac r0e25780  
    156156        $(USPACE_PATH)/app/edit/edit \
    157157        $(USPACE_PATH)/app/ext2info/ext2info \
     158        $(USPACE_PATH)/app/inetcfg/inetcfg \
    158159        $(USPACE_PATH)/app/kill/kill \
    159160        $(USPACE_PATH)/app/killall/killall \
  • uspace/Makefile

    r3d016ac r0e25780  
    4242        app/getterm \
    4343        app/init \
     44        app/inetcfg \
    4445        app/kill \
    4546        app/killall \
  • uspace/lib/c/Makefile

    r3d016ac r0e25780  
    8888        generic/futex.c \
    8989        generic/inet.c \
     90        generic/inetcfg.c \
    9091        generic/io/asprintf.c \
    9192        generic/io/io.c \
  • uspace/lib/c/include/ipc/inet.h

    r3d016ac r0e25780  
    3838#include <ipc/common.h>
    3939
     40/** Inet ports */
     41typedef enum {
     42        /** Default port */
     43        INET_PORT_DEFAULT = 1,
     44        /** Configuration port */
     45        INET_PORT_CFG
     46} inet_port_t;
     47
     48/** Requests on Inet default port */
    4049typedef enum {
    4150        INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
     
    4554} inet_request_t;
    4655
     56/** Events on Inet default port */
    4757typedef enum {
    4858        INET_EV_RECV = IPC_FIRST_USER_METHOD
    4959} inet_event_t;
     60
     61/** Requests on Inet configuration port */
     62typedef enum {
     63        INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD,
     64        INETCFG_ADDR_DELETE,
     65        INETCFG_ADDR_GET,
     66        INETCFG_GET_ADDR_LIST,
     67        INETCFG_GET_LINK_LIST,
     68        INETCFG_LINK_GET,
     69} inetcfg_request_t;
    5070
    5171#endif
  • uspace/lib/c/include/ipc/services.h

    r3d016ac r0e25780  
    5252} services_t;
    5353
    54 #define SERVICE_NAME_INET "net/inet"
     54#define SERVICE_NAME_INET    "net/inet"
     55#define SERVICE_NAME_INETCFG "net/inetcfg"
    5556
    5657#endif
  • uspace/srv/inet/Makefile

    r3d016ac r0e25780  
    3434        inet.c \
    3535        inet_link.c \
     36        inetcfg.c \
    3637        pdu.c
    3738
  • uspace/srv/inet/inet.c

    r3d016ac r0e25780  
    4949#include "addrobj.h"
    5050#include "inet.h"
     51#include "inetcfg.h"
    5152#include "inet_link.h"
    5253
     
    7374        }
    7475
    75         rc = loc_service_register(SERVICE_NAME_INET, &sid);
     76        rc = loc_service_register_with_iface(SERVICE_NAME_INET, &sid,
     77            INET_PORT_DEFAULT);
     78        if (rc != EOK) {
     79                log_msg(LVL_ERROR, "Failed registering service (%d).", rc);
     80                return EEXIST;
     81        }
     82
     83        rc = loc_service_register_with_iface(SERVICE_NAME_INETCFG, &sid,
     84            INET_PORT_CFG);
    7685        if (rc != EOK) {
    7786                log_msg(LVL_ERROR, "Failed registering service (%d).", rc);
     
    220229}
    221230
    222 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     231static void inet_default_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    223232{
    224233        inet_client_t client;
    225234
    226         log_msg(LVL_DEBUG, "inet_client_conn()");
     235        log_msg(LVL_DEBUG, "inet_default_conn()");
    227236
    228237        /* Accept the connection */
     
    263272}
    264273
     274static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     275{
     276        sysarg_t port;
     277
     278        log_msg(LVL_DEBUG, "inet_client_conn(%d, %d, %d)",
     279        (int)IPC_GET_ARG1(*icall), (int)IPC_GET_ARG2(*icall),
     280        (int)IPC_GET_ARG3(*icall));
     281
     282        port = IPC_GET_ARG1(*icall);
     283
     284        switch (port) {
     285        case INET_PORT_DEFAULT:
     286                inet_default_conn(iid, icall, arg);
     287                break;
     288        case INET_PORT_CFG:
     289                inet_cfg_conn(iid, icall, arg);
     290                break;
     291        default:
     292                printf("uknown port number %d\n", port);
     293                async_answer_0(iid, ENOTSUP);
     294                break;
     295        }
     296}
     297
    265298static inet_client_t *inet_client_find(uint8_t proto)
    266299{
  • uspace/srv/inet/inet.h

    r3d016ac r0e25780  
    6464} inet_naddr_t;
    6565
     66/** Address object info */
     67typedef struct {
     68        /** Network address */
     69        inet_naddr_t naddr;
     70} inet_addr_info_t;
     71
     72/** IP link info */
     73typedef struct {
     74        int dummy;
     75} inet_link_info_t;
     76
    6677typedef struct {
    6778        inet_addr_t src;
Note: See TracChangeset for help on using the changeset viewer.