Ejemplo n.º 1
0
static void func_globalfree (struct NCDInterpModuleGroup *group)
{
    struct global *g = group->group_state;
    ASSERT(LinkedList1_IsEmpty(&g->instances))
    
    // free global state structure
    BFree(g);
}
Ejemplo n.º 2
0
void DPReceiveDevice_Free (DPReceiveDevice *o)
{
    DebugObject_Free(&o->d_obj);
    ASSERT(LinkedList1_IsEmpty(&o->peers_list))
    
    // free relay router
    DPRelayRouter_Free(&o->relay_router);
}
Ejemplo n.º 3
0
static void schedule_job_handler (PacketPassFifoQueue *o)
{
    DebugObject_Access(&o->d_obj);
    ASSERT(!o->freeing)
    ASSERT(!o->sending_flow)
    
    if (!LinkedList1_IsEmpty(&o->waiting_flows_list)) {
        schedule(o);
    }
}
Ejemplo n.º 4
0
void PacketPassFifoQueue_Free (PacketPassFifoQueue *o)
{
    DebugObject_Free(&o->d_obj);
    DebugCounter_Free(&o->d_flows_ctr);
    ASSERT(LinkedList1_IsEmpty(&o->waiting_flows_list))
    ASSERT(!o->sending_flow)
    
    // free schedule job
    BPending_Free(&o->schedule_job);
}
static void free_oldest_frame (FragmentProtoAssembler *o)
{
    ASSERT(!LinkedList1_IsEmpty(&o->frames_used))
    
    // obtain oldest frame (first on the list)
    LinkedList1Node *list_node = LinkedList1_GetFirst(&o->frames_used);
    ASSERT(list_node)
    struct FragmentProtoAssembler_frame *frame = UPPER_OBJECT(list_node, struct FragmentProtoAssembler_frame, list_node);
    
    // free frame
    free_frame(o, frame);
}
Ejemplo n.º 6
0
static void func_die (void *vo)
{
    struct instance *o = vo;
    ASSERT(!o->dying)
    
    // if we have no users, die right away, else wait for users
    if (LinkedList1_IsEmpty(&o->users)) {
        instance_free(o);
        return;
    }
    
    // set dying
    o->dying = 1;
}
Ejemplo n.º 7
0
static void instance_free (struct instance *o)
{
    ASSERT(LinkedList1_IsEmpty(&o->users))
    
    // break any rdownups
    LinkedList0Node *ln;
    while (ln = LinkedList0_GetFirst(&o->rdownups_list)) {
        struct rdownup_instance *rdu = UPPER_OBJECT(ln, struct rdownup_instance, rdownups_list_node);
        ASSERT(rdu->blocker == o)
        LinkedList0_Remove(&o->rdownups_list, &rdu->rdownups_list_node);
        rdu->blocker = NULL;
    }
    
    NCDModuleInst_Backend_Dead(o->i);
}
Ejemplo n.º 8
0
static void schedule (PacketPassFifoQueue *o)
{
    ASSERT(!o->freeing)
    ASSERT(!o->sending_flow)
    ASSERT(!LinkedList1_IsEmpty(&o->waiting_flows_list))
    ASSERT(!BPending_IsSet(&o->schedule_job))
    
    // get first waiting flow
    PacketPassFifoQueueFlow *flow = UPPER_OBJECT(LinkedList1_GetFirst(&o->waiting_flows_list), PacketPassFifoQueueFlow, waiting_flows_list_node);
    ASSERT(flow->queue == o)
    ASSERT(flow->is_waiting)
    
    // remove it from queue
    LinkedList1_Remove(&o->waiting_flows_list, &flow->waiting_flows_list_node);
    flow->is_waiting = 0;
    
    // send
    PacketPassInterface_Sender_Send(o->output, flow->waiting_data, flow->waiting_len);
    o->sending_flow = flow;
}
Ejemplo n.º 9
0
void BPendingGroup_ExecuteJob (BPendingGroup *g)
{
    ASSERT(!LinkedList1_IsEmpty(&g->jobs))
    DebugObject_Access(&g->d_obj);
    
    // get a job
    LinkedList1Node *node = LinkedList1_GetLast(&g->jobs);
    BPending *p = UPPER_OBJECT(node, BPending, pending_node);
    ASSERT(p->pending)
    
    // remove from jobs list
    LinkedList1_Remove(&g->jobs, &p->pending_node);
    
    // set not pending
    p->pending = 0;
    
    // execute job
    p->handler(p->user);
    return;
}
Ejemplo n.º 10
0
int BPendingGroup_HasJobs (BPendingGroup *g)
{
    DebugObject_Access(&g->d_obj);
    
    return !LinkedList1_IsEmpty(&g->jobs);
}
Ejemplo n.º 11
0
void BPendingGroup_Free (BPendingGroup *g)
{
    DebugCounter_Free(&g->pending_ctr);
    ASSERT(LinkedList1_IsEmpty(&g->jobs))
    DebugObject_Free(&g->d_obj);
}
Ejemplo n.º 12
0
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdlib.h>

#include <misc/offset.h>
#include <misc/debug.h>
#include <misc/balloc.h>

#include <ncd/modules/event_template.h>

#define TemplateLog(o, ...) NCDModuleInst_Backend_Log((o)->i, (o)->blog_channel, __VA_ARGS__)

static void enable_event (event_template *o)
{
    ASSERT(!LinkedList1_IsEmpty(&o->events_list))
    ASSERT(!o->enabled)
    
    // get event
    struct event_template_event *e = UPPER_OBJECT(LinkedList1_GetFirst(&o->events_list), struct event_template_event, events_list_node);
    
    // remove from events list
    LinkedList1_Remove(&o->events_list, &e->events_list_node);
    
    // grab enabled map
    o->enabled_map = e->map;
    
    // append to free list
    LinkedList1_Append(&o->free_list, &e->events_list_node);
    
    // set enabled