10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53431Scarlsonj * Common Development and Distribution License (the "License"). 63431Scarlsonj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9508SPeter.Memishian@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef SCRIPT_HANDLER_H 270Sstevel@tonic-gate #define SCRIPT_HANDLER_H 280Sstevel@tonic-gate 293431Scarlsonj #include "common.h" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * The signal SIGTERM is sent to a script process if it does not exit after 370Sstevel@tonic-gate * SCRIPT_TIMEOUT seconds; and the signal SIGKILL is sent if it is still alive 380Sstevel@tonic-gate * SCRIPT_TIMEOUT_GRACE seconds after SIGTERM is sent. (SCRIPT_TIMEOUT + 390Sstevel@tonic-gate * SCRIPT_TIMEOUT_GRACE) should be less than DHCP_ASYNC_WAIT. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate #define SCRIPT_TIMEOUT 55 420Sstevel@tonic-gate #define SCRIPT_TIMEOUT_GRACE 3 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * script exit status as dhcpagent sees it, for debug purpose only. 460Sstevel@tonic-gate * 470Sstevel@tonic-gate * SCRIPT_OK: script exits ok, no timeout 480Sstevel@tonic-gate * SCRIPT_KILLED: script timeout, killed 490Sstevel@tonic-gate * SCRIPT_FAILED: unknown status 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate 520Sstevel@tonic-gate enum { SCRIPT_OK, SCRIPT_KILLED, SCRIPT_FAILED }; 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * event names for script. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate #define EVENT_BOUND "BOUND" 580Sstevel@tonic-gate #define EVENT_EXTEND "EXTEND" 590Sstevel@tonic-gate #define EVENT_EXPIRE "EXPIRE" 600Sstevel@tonic-gate #define EVENT_DROP "DROP" 613431Scarlsonj #define EVENT_INFORM "INFORM" 620Sstevel@tonic-gate #define EVENT_RELEASE "RELEASE" 630Sstevel@tonic-gate 643431Scarlsonj #define EVENT_BOUND6 "BOUND6" 653431Scarlsonj #define EVENT_EXTEND6 "EXTEND6" 663431Scarlsonj #define EVENT_EXPIRE6 "EXPIRE6" 673431Scarlsonj #define EVENT_DROP6 "DROP6" 683431Scarlsonj #define EVENT_INFORM6 "INFORM6" 693431Scarlsonj #define EVENT_LOSS6 "LOSS6" 703431Scarlsonj #define EVENT_RELEASE6 "RELEASE6" 713431Scarlsonj 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * script location. 740Sstevel@tonic-gate */ 750Sstevel@tonic-gate #define SCRIPT_PATH "/etc/dhcp/eventhook" 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* 780Sstevel@tonic-gate * the number of running scripts. 790Sstevel@tonic-gate */ 800Sstevel@tonic-gate extern unsigned int script_count; 810Sstevel@tonic-gate 82*9508SPeter.Memishian@Sun.COM void script_init(dhcp_smach_t *); 833431Scarlsonj boolean_t script_start(dhcp_smach_t *, const char *, script_callback_t *, 843431Scarlsonj void *, int *); 853431Scarlsonj void script_stop(dhcp_smach_t *); 860Sstevel@tonic-gate 870Sstevel@tonic-gate #ifdef __cplusplus 880Sstevel@tonic-gate } 890Sstevel@tonic-gate #endif 900Sstevel@tonic-gate 910Sstevel@tonic-gate #endif /* SCRIPT_HANDLER_H */ 92