00001 #ifndef DMQNODE_H
00002 #define DMQNODE_H
00003
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "../../lock_ops.h"
00007 #include "../../str.h"
00008 #include "../../mem/mem.h"
00009 #include "../../mem/shm_mem.h"
00010 #include "../../parser/parse_uri.h"
00011 #include "../../parser/parse_param.h"
00012
00013 #define NBODY_LEN 1024
00014 #define DMQ_NODE_ACTIVE 1 << 1
00015 #define DMQ_NODE_TIMEOUT 1 << 2
00016 #define DMQ_NODE_DISABLED 1 << 3
00017
00018 typedef struct dmq_node {
00019 int local;
00020 str orig_uri;
00021 struct sip_uri uri;
00022 param_t* params;
00023 int status;
00024 int last_notification;
00025 struct dmq_node* next;
00026 } dmq_node_t;
00027
00028 typedef struct dmq_node_list {
00029 gen_lock_t lock;
00030 struct dmq_node* nodes;
00031 int count;
00032 } dmq_node_list_t;
00033
00034 extern str dmq_node_status_str;
00035 extern dmq_node_list_t* node_list;
00036
00037 dmq_node_list_t* init_dmq_node_list();
00038 dmq_node_t* build_dmq_node(str* uri, int shm);
00039 int update_node_list(dmq_node_list_t* remote_list);
00040 dmq_node_t* add_dmq_node(dmq_node_list_t* list, str* uri);
00041 dmq_node_t* find_dmq_node(dmq_node_list_t* list, dmq_node_t* node);
00042 dmq_node_t* find_dmq_node_uri(dmq_node_list_t* list, str* uri);
00043 int del_dmq_node(dmq_node_list_t* list, dmq_node_t* node);
00044 int cmp_dmq_node(dmq_node_t* node, dmq_node_t* cmpnode);
00045 dmq_node_t* shm_dup_node(dmq_node_t* node);
00046 void destroy_dmq_node(dmq_node_t* node, int shm);
00047 void shm_free_node(dmq_node_t* node);
00048 void pkg_free_node(dmq_node_t* node);
00049 int set_dmq_node_params(dmq_node_t* node, param_t* params);
00050
00051 str* get_status_str(int status);
00052 int build_node_str(dmq_node_t* node, char* buf, int buflen);
00053
00054 extern dmq_node_t* self_node;
00055 extern dmq_node_t* notification_node;
00056
00057 #endif
00058