Changeset f9b2cb4c in mainline for uspace/srv/net/inetsrv/inetsrv.c


Ignore:
Timestamp:
2015-08-23T12:50:23Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ef495f
Parents:
0dd16778
Message:

unify interface API

  • introduce new interfaces
  • unify location service clients to always expect service ID as the second argument
  • remove obsolete methods that take explicit exchange management arguments (first phase)
  • use interfaces in device drivers, devman, location service, logger, inet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/inetsrv.c

    r0dd16778 rf9b2cb4c  
    7777};
    7878
    79 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    80 
    8179static FIBRIL_MUTEX_INITIALIZE(client_list_lock);
    8280static LIST_INITIALIZE(client_list);
    8381
     82static void inet_default_conn(ipc_callid_t, ipc_call_t *, void *);
     83
    8484static int inet_init(void)
    8585{
    8686        log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()");
    8787       
    88         async_set_fallback_port_handler(inet_client_conn, NULL);
    89        
    90         int rc = loc_server_register(NAME);
     88        port_id_t port;
     89        int rc = async_create_port(INTERFACE_INET,
     90            inet_default_conn, NULL, &port);
     91        if (rc != EOK)
     92                return rc;
     93       
     94        rc = async_create_port(INTERFACE_INETCFG,
     95            inet_cfg_conn, NULL, &port);
     96        if (rc != EOK)
     97                return rc;
     98       
     99        rc = async_create_port(INTERFACE_INETPING,
     100            inetping_conn, NULL, &port);
     101        if (rc != EOK)
     102                return rc;
     103       
     104        rc = loc_server_register(NAME);
    91105        if (rc != EOK) {
    92106                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc);
     
    95109       
    96110        service_id_t sid;
    97         rc = loc_service_register_with_iface(SERVICE_NAME_INET, &sid,
    98             INET_PORT_DEFAULT);
    99         if (rc != EOK) {
    100                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
    101                 return EEXIST;
    102         }
    103        
    104         rc = loc_service_register_with_iface(SERVICE_NAME_INETCFG, &sid,
    105             INET_PORT_CFG);
    106         if (rc != EOK) {
    107                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
    108                 return EEXIST;
    109         }
    110        
    111         rc = loc_service_register_with_iface(SERVICE_NAME_INETPING, &sid,
    112             INET_PORT_PING);
     111        rc = loc_service_register(SERVICE_NAME_INET, &sid);
    113112        if (rc != EOK) {
    114113                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);
     
    429428}
    430429
    431 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    432 {
    433         sysarg_t port;
    434 
    435         port = IPC_GET_ARG1(*icall);
    436 
    437         switch (port) {
    438         case INET_PORT_DEFAULT:
    439                 inet_default_conn(iid, icall, arg);
    440                 break;
    441         case INET_PORT_CFG:
    442                 inet_cfg_conn(iid, icall, arg);
    443                 break;
    444         case INET_PORT_PING:
    445                 inetping_conn(iid, icall, arg);
    446                 break;
    447         default:
    448                 async_answer_0(iid, ENOTSUP);
    449                 break;
    450         }
    451 }
    452 
    453430static inet_client_t *inet_client_find(uint8_t proto)
    454431{
Note: See TracChangeset for help on using the changeset viewer.