Navigation



Ignore:
Timestamp:
Dec 2, 2009, 6:28:28 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Started support for routing module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/freeDiameter.h

    r82 r83  
    427427
    428428/***************************************/
     429/*          Routing module             */
     430/***************************************/
     431
     432/* This file contains the definitions of types and functions involved in the routing decisions in freeDiameter,
     433 * and that can be called by extensions.
     434 *
     435 * Three different type of messages must be distinguished:
     436 *  - Messages received, and the peer is final recipient (IN messages)
     437 *  - Messages received, and the peer is not final recipient (FWD messages)
     438 *  - Message is locally generated (OUT messages)
     439 *
     440 * There are three global message queues (in queues.c) and also peers-specific queues (in struct fd_peer).
     441 *
     442 * (*) IN messages processing details:
     443 *   - the message is received from the remote peer, a FDEVP_CNX_MSG_RECV event is generated for the peer.
     444 *   - the PSM thread parses the buffer, does some verifications, handles non routable messages (fd_msg_is_routable)
     445 *   - routable messages are queued in the fd_g_incoming global queue.
     446 *   - a thread (routing-in) picks the message and takes the decision if it is handled locally or forwarded,
     447 *       based on local capabilities (registered by extensions).
     448 *   - If the message is handled locally, it is queued in fd_g_local.
     449 *   - Another thread (dispatch.c) will handle this message and pass it to registered callbacks (see fd_disp_register in libfreeDiameter.h).
     450 *
     451 * (*) FWD messages details:
     452 *   - The process is the same as for IN messages, until the routing-in threads makes its decision that the message is not handled locally.
     453 *   - All callbacks registered with fd_rt_fwd_register are called for the message (see bellow).
     454 *     - these callbacks will typically do proxying work. Note that adding the route-record is handled by the daemon.
     455 *   - Once all callbacks have been called, the message is queued in the global fd_g_outgoing queue.
     456 *   - The remaining processing is the same as for OUT messages, as described bellow.
     457 *
     458 * (*) OUT messages details:
     459 *   - The message are picked from fd_g_outgoing, as result of forwarding process or call to fd_msg_send.
     460 *   - The (routing-out) thread builds a list of possible destinations for the message.
     461 *     The logic to build this list is as follow:
     462 *      - create a list of all known peers in the "OPEN" state.
     463 *      - remove from that list all peers that are in a Route-Record AVP of the message, to avoid routing loops.
     464 *      - remove also all peers that have previously replied an error message for this message.
     465 *   - If the list is empty, create an error UNABLE_TO_DELIVER (note: should we trig dynamic discovery here???) and reply this.
     466 *   - Otherwise, call all callbacks registered by function fd_rt_out_register, with the list of peers and the message.
     467 *   - Order the resulting list of peers by score (see bellow), and sent the message to the peer with highest (positive) score.
     468 *    - in case the peer is no longer in the "OPEN" state, send the message to the second peer in the list.
     469 *      - if no peer is in OPEN state anymore, restart the process of creating the list.
     470 *   - The peer thread will handle the creation of the Hop-by-hop ID and sending the message.
     471 *
     472 * This part of the API (routing-api.h) provides the definitions of the rt_out_cb_t and rt_fwd_cb_t callbacks, and the
     473 * functions to register and deregister these callbacks.
     474 */
     475
     476
     477
     478/***************************************/
    429479/*   Events helpers                    */
    430480/***************************************/
    431481
    432 /* Events */
    433482struct fd_event {
    434483        int      code; /* codespace depends on the queue */
     
    437486};
    438487
    439 /* Daemon's codespace: 1000->1999 */
     488/* Daemon's codespace: 1000->1999 (1500->1999 defined in fD.h) */
    440489enum {
    441490         FDEV_TERMINATE = 1000  /* request to terminate */
Note: See TracChangeset for help on using the changeset viewer.