1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2017 Jason King.
  27  * Copyright 2017 Joyent, Inc.
  28  */
  29 /*
  30  * Timer events are sorted into a single mutex-protected list.
  31  * They are insertion-sorted by next-to-expire.
  32  */
  33 
  34 #ifndef _TIMER_H
  35 #define _TIMER_H
  36 
  37 #include <bunyan.h>
  38 #include <sys/types.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 typedef enum {
  45         TE_TEST = -1,   /* For code testing only, arg == NULL */
  46         TE_ANY,         /* MUST NOT be passed to schedule_timeout() */
  47         TE_SA_EXPIRE,   /* SA expiration */
  48         TE_COOKIE_GEN,  /* Cookie generation */
  49         TE_TRANSMIT,    /* Transmit timeout */
  50         TE_PFKEY        /* pfkey timeout */
  51 } te_event_t;
  52 
  53 typedef void (*tevent_cb_fn)(te_event_t, void *);
  54 
  55 extern void             process_timer(timespec_t *, bunyan_logger_t *);
  56 extern int              cancel_timeout(te_event_t, void *, bunyan_logger_t *);
  57 extern boolean_t        schedule_timeout(te_event_t, tevent_cb_fn, void *,
  58     hrtime_t);
  59 
  60 extern void ike_timer_init(void);
  61 extern void ike_timer_thread_init(void);
  62 
  63 #ifdef  __cplusplus
  64 }
  65 #endif
  66 
  67 #endif  /* _TIMER_H */