ped_schedule.c File Reference

Init and play with timers. More...

#include <sync/common.h>
#include "ped_schedule.h"
#include "ped_services.h"
#include "ped_logging.h"

Go to the source code of this file.

Functions

static void ped_restart (evContext ctx __unused, void *uap __unused, struct timespec due __unused, struct timespec inter __unused)
static void ped_periodic (evContext ctx __unused, void *uap __unused, struct timespec due __unused, struct timespec inter __unused)
int ped_schedule_init (void)
void ped_schedule_reset (void)
void ped_schedule_stop (void)

Variables

static evTimerID timer_id
 timer ID used by interface description
static boolean timer_set
 is the timer set
static uint32_t period
 periodic update time (seconds)
evContext ped_ctx
 Event context for ped.


Detailed Description

Init and play with timers.

Initialize timers

Definition in file ped_schedule.c.


Function Documentation

static void ped_periodic ( evContext ctx  __unused,
void *uap  __unused,
struct timespec due  __unused,
struct timespec inter  __unused 
) [static]

On timer expiry we process periodic events. If this gets called more than MAX_RETRY_ATTEMPTS in less than SCHEDULE_STOP_RETRY seconds, then it does not process events and it will cancel these regular periodic events for SCHEDULE_RESTART_TIME seconds. After that ped_restart is called.

Periodic events include: We update the interfaces via the PSD.

Parameters:
[in] ctx The event context for this application
[in] uap The user data for this callback
[in] due The absolute time when the event is due (now)
[in] inter The period; when this will next be called

Definition at line 92 of file ped_schedule.c.

References check_psd_hb(), MAX_RETRY_ATTEMPTS, ped_ctx, ped_restart(), ped_schedule_reset(), SCHEDULE_RESTART_TIME, SCHEDULE_STOP_RETRY, timer_id, and timer_set.

Referenced by ped_schedule_reset().

static void ped_restart ( evContext ctx  __unused,
void *uap  __unused,
struct timespec due  __unused,
struct timespec inter  __unused 
) [static]

On the "stop" timer expiry event we we restart the scheduler.

Parameters:
[in] ctx The event context for this application
[in] uap The user data for this callback
[in] due The absolute time when the event is due (now)
[in] inter The period; when this will next be called

Definition at line 58 of file ped_schedule.c.

References ped_schedule_reset().

Referenced by ped_periodic().

int ped_schedule_init ( void   ) 

Initialize the internals necessary for the periodic timer/scheduler. Does not set timers. That's done with ped_schedule_reset. This must be called before using ped_schedule_reset.

Returns:
0 on success, and -1 on error

Definition at line 164 of file ped_schedule.c.

References period, SCHEDULE_PERIOD, and timer_set.

Referenced by ped_init().

void ped_schedule_reset ( void   ) 

Clear existing timer if it exists, and set the timer fresh again. Starts a periodic timer every SCHEDULE_PERIOD seconds, and a one-shot timer that goes off in SCHEDULE_IMMEDIATE_DELAY seconds. Timer callback is ped_periodic.

If we're resetting, then something went wrong most likely (or it's a configuration load/reload) so we have a small delay timer before retrying. If all goes well, then the periodic timer will continue checks after that.

Definition at line 187 of file ped_schedule.c.

References ped_ctx, ped_periodic(), period, SCHEDULE_IMMEDIATE_DELAY, timer_id, and timer_set.

Referenced by ped_init(), ped_periodic(), and ped_restart().

void ped_schedule_stop ( void   ) 

Clear existing schedule for shutdown

Definition at line 221 of file ped_schedule.c.

References ped_ctx, timer_id, and timer_set.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:06 2010 for SDK Your Net Corporation Policy Manager Example: Policy Enforcement Daemon 1.0 by Doxygen 1.5.1