Back to index

im-sdk  12.3.91
Classes | Functions
handler.h File Reference
#include <iiimp-data.h>
#include <iiimp.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  iiimf_message_handler_entry

Functions

IIIMF_status iiimf_message_handler_entry_new (IIIMF_message_handler_entry ***entry_ret)
void iiimf_message_handler_entry_delete (IIIMF_message_handler_entry **entry)
void iiimf_message_handler_entry_item_delete (IIIMF_message_handler_entry *enty)
IIIMF_status iiimf_message_handler_call (IIIMF_im *im, IIIMP_message *message)

Class Documentation

struct iiimf_message_handler_entry

Definition at line 14 of file handler.h.

Collaboration diagram for iiimf_message_handler_entry:
Class Members
char * name
struct
iiimf_message_handler_entry *
next
IIIMF_message_handler proc

Function Documentation

IIIMF_status iiimf_message_handler_call ( IIIMF_im *  im,
IIIMP_message message 
)

Definition at line 232 of file handler.c.

{
    IIIMF_ic *                            ic;
    IIIMF_message_handler_status   status;
    IIIMF_message_handler_entry *  entry;

    entry = *(im->message_handler + message->opcode);
    if ((NULL == entry) || (NULL == entry->proc)) {
       return IIIMF_STATUS_SUCCESS;
    }

    if (0 <= message->ic_id) {
       for (ic = im->ic_list; NULL != ic; ic = ic->next) {
           if ( message->ic_id == ic->ic_id) break;
       }
       if (NULL == ic) return IIIMF_STATUS_INVALID_ID;
    } else {
       ic = NULL;
    }

    for (; NULL != entry; entry = entry->next) {
       status = (*(entry->proc))(im, ic, message);
       if (IIIMF_MESSAGE_HANDLER_STATUS_NORMAL == status) {
           continue;
       } else if (IIIMF_MESSAGE_HANDLER_STATUS_STOP == status) {
           return IIIMF_STATUS_SUCCESS;
       } else {
           return IIIMF_STATUS_FAIL;
       }
    }

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function:

void iiimf_message_handler_entry_delete ( IIIMF_message_handler_entry **  entry)

Definition at line 36 of file handler.c.

{
    IIIMF_message_handler_entry *  e;
    IIIMF_message_handler_entry *  e_next;
    int                                   i;

    for (i = 0; i < 128; i++) {
       for (e = *(entry + i); NULL != e; e = e_next) {
           e_next = e->next;
           iiimf_message_handler_entry_item_delete(e);
       }
    }

    free(entry);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void iiimf_message_handler_entry_item_delete ( IIIMF_message_handler_entry *  enty)

Definition at line 79 of file handler.c.

{
    free(entry->name);
    free(entry);
}

Here is the caller graph for this function:

IIIMF_status iiimf_message_handler_entry_new ( IIIMF_message_handler_entry ***  entry_ret)

Definition at line 13 of file handler.c.

{
    IIIMF_message_handler_entry ** entry;
    size_t                         size;
    int                                   i;

    size = ((sizeof (IIIMF_message_handler_entry *)) * 128);

    entry = (IIIMF_message_handler_entry **)malloc(size);
    if (NULL == entry) return IIIMF_STATUS_MALLOC;

    for (i = 0; i < 128; i++) {
       *(entry + i) = NULL;
    }

    *entry_ret = entry;

    return IIIMF_STATUS_SUCCESS;
}

Here is the caller graph for this function: