Subversion Repositories HelenOS

Rev

Rev 2569 | Rev 2621 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2569 Rev 2619
Line 73... Line 73...
73
 *
73
 *
74
 *
74
 *
75
 * my_client_connection(icallid, *icall)
75
 * my_client_connection(icallid, *icall)
76
 * {
76
 * {
77
 *  if (want_refuse) {
77
 *  if (want_refuse) {
78
 *      ipc_answer_fast(icallid, ELIMIT, 0, 0);
78
 *      ipc_answer_0(icallid, ELIMIT);
79
 *      return;
79
 *      return;
80
 *  }
80
 *  }
81
 *  ipc_answer_fast(icallid, EOK, 0, 0);
81
 *  ipc_answer_0(icallid, EOK);
82
 *
82
 *
83
 *  callid = async_get_call(&call);
83
 *  callid = async_get_call(&call);
84
 *  handle_call(callid, call);
84
 *  handle_call(callid, call);
85
 *  ipc_answer_fast(callid, 1, 2, 3);
85
 *  ipc_answer_2(callid, 1, 2, 3);
86
 *
86
 *
87
 *  callid = async_get_call(&call);
87
 *  callid = async_get_call(&call);
88
 *  ....
88
 *  ....
89
 * }
89
 * }
90
 *
90
 *
Line 393... Line 393...
393
 * @param callid    Hash of the incoming call.
393
 * @param callid    Hash of the incoming call.
394
 * @param call      Data of the incoming call.
394
 * @param call      Data of the incoming call.
395
 */
395
 */
396
static void default_client_connection(ipc_callid_t callid, ipc_call_t *call)
396
static void default_client_connection(ipc_callid_t callid, ipc_call_t *call)
397
{
397
{
398
    ipc_answer_fast(callid, ENOENT, 0, 0);
398
    ipc_answer_0(callid, ENOENT);
399
}
399
}
400
 
400
 
401
/** Default fibril function that gets called to handle interrupt notifications.
401
/** Default fibril function that gets called to handle interrupt notifications.
402
 *
402
 *
403
 * @param callid    Hash of the incoming call.
403
 * @param callid    Hash of the incoming call.
Line 438... Line 438...
438
        msg = list_get_instance(FIBRIL_connection->msg_queue.next,
438
        msg = list_get_instance(FIBRIL_connection->msg_queue.next,
439
            msg_t, link);
439
            msg_t, link);
440
        list_remove(&msg->link);
440
        list_remove(&msg->link);
441
        if (msg->callid == FIBRIL_connection->close_callid)
441
        if (msg->callid == FIBRIL_connection->close_callid)
442
            close_answered = 1;
442
            close_answered = 1;
443
        ipc_answer_fast(msg->callid, EHANGUP, 0, 0);
443
        ipc_answer_0(msg->callid, EHANGUP);
444
        free(msg);
444
        free(msg);
445
    }
445
    }
446
    if (FIBRIL_connection->close_callid)
446
    if (FIBRIL_connection->close_callid)
447
        ipc_answer_fast(FIBRIL_connection->close_callid, 0, 0, 0);
447
        ipc_answer_0(FIBRIL_connection->close_callid, EOK);
448
   
448
   
449
    return 0;
449
    return 0;
450
}
450
}
451
 
451
 
452
/** Create a new fibril for a new connection.
452
/** Create a new fibril for a new connection.
Line 473... Line 473...
473
    unsigned long key;
473
    unsigned long key;
474
 
474
 
475
    conn = malloc(sizeof(*conn));
475
    conn = malloc(sizeof(*conn));
476
    if (!conn) {
476
    if (!conn) {
477
        if (callid)
477
        if (callid)
478
            ipc_answer_fast(callid, ENOMEM, 0, 0);
478
            ipc_answer_0(callid, ENOMEM);
479
        return NULL;
479
        return NULL;
480
    }
480
    }
481
    conn->in_phone_hash = in_phone_hash;
481
    conn->in_phone_hash = in_phone_hash;
482
    list_initialize(&conn->msg_queue);
482
    list_initialize(&conn->msg_queue);
483
    conn->callid = callid;
483
    conn->callid = callid;
Line 489... Line 489...
489
 
489
 
490
    conn->wdata.fid = fibril_create(connection_fibril, conn);
490
    conn->wdata.fid = fibril_create(connection_fibril, conn);
491
    if (!conn->wdata.fid) {
491
    if (!conn->wdata.fid) {
492
        free(conn);
492
        free(conn);
493
        if (callid)
493
        if (callid)
494
            ipc_answer_fast(callid, ENOMEM, 0, 0);
494
            ipc_answer_0(callid, ENOMEM);
495
        return NULL;
495
        return NULL;
496
    }
496
    }
497
    /* Add connection to the connection hash table */
497
    /* Add connection to the connection hash table */
498
    key = conn->in_phone_hash;
498
    key = conn->in_phone_hash;
499
    futex_down(&async_futex);
499
    futex_down(&async_futex);
Line 534... Line 534...
534
    /* Try to route the call through the connection hash table */
534
    /* Try to route the call through the connection hash table */
535
    if (route_call(callid, call))
535
    if (route_call(callid, call))
536
        return;
536
        return;
537
 
537
 
538
    /* Unknown call from unknown phone - hang it up */
538
    /* Unknown call from unknown phone - hang it up */
539
    ipc_answer_fast(callid, EHANGUP, 0, 0);
539
    ipc_answer_0(callid, EHANGUP);
540
}
540
}
541
 
541
 
542
/** Fire all timeouts that expired. */
542
/** Fire all timeouts that expired. */
543
static void handle_expired_timeouts(void)
543
static void handle_expired_timeouts(void)
544
{
544
{