1*5c51f124SMoriah Waterland /* 2*5c51f124SMoriah Waterland * CDDL HEADER START 3*5c51f124SMoriah Waterland * 4*5c51f124SMoriah Waterland * The contents of this file are subject to the terms of the 5*5c51f124SMoriah Waterland * Common Development and Distribution License (the "License"). 6*5c51f124SMoriah Waterland * You may not use this file except in compliance with the License. 7*5c51f124SMoriah Waterland * 8*5c51f124SMoriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5c51f124SMoriah Waterland * or http://www.opensolaris.org/os/licensing. 10*5c51f124SMoriah Waterland * See the License for the specific language governing permissions 11*5c51f124SMoriah Waterland * and limitations under the License. 12*5c51f124SMoriah Waterland * 13*5c51f124SMoriah Waterland * When distributing Covered Code, include this CDDL HEADER in each 14*5c51f124SMoriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5c51f124SMoriah Waterland * If applicable, add the following below this CDDL HEADER, with the 16*5c51f124SMoriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying 17*5c51f124SMoriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner] 18*5c51f124SMoriah Waterland * 19*5c51f124SMoriah Waterland * CDDL HEADER END 20*5c51f124SMoriah Waterland */ 21*5c51f124SMoriah Waterland 22*5c51f124SMoriah Waterland /* 23*5c51f124SMoriah Waterland * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24*5c51f124SMoriah Waterland * Use is subject to license terms. 25*5c51f124SMoriah Waterland */ 26*5c51f124SMoriah Waterland 27*5c51f124SMoriah Waterland #ifndef _PKGWEB_H 28*5c51f124SMoriah Waterland #define _PKGWEB_H 29*5c51f124SMoriah Waterland 30*5c51f124SMoriah Waterland 31*5c51f124SMoriah Waterland #ifdef __cplusplus 32*5c51f124SMoriah Waterland extern "C" { 33*5c51f124SMoriah Waterland #endif 34*5c51f124SMoriah Waterland 35*5c51f124SMoriah Waterland #include <netdb.h> 36*5c51f124SMoriah Waterland #include <boot_http.h> 37*5c51f124SMoriah Waterland 38*5c51f124SMoriah Waterland /* shortest backoff delay possible (in seconds) */ 39*5c51f124SMoriah Waterland #define MIN_BACKOFF 1 40*5c51f124SMoriah Waterland 41*5c51f124SMoriah Waterland /* how much to increase backoff time after each failure */ 42*5c51f124SMoriah Waterland #define BACKOFF_FACTOR 2 43*5c51f124SMoriah Waterland 44*5c51f124SMoriah Waterland /* Maximum amount of backoff for a heavy network or flaky server */ 45*5c51f124SMoriah Waterland #define MAX_BACKOFF 128 46*5c51f124SMoriah Waterland 47*5c51f124SMoriah Waterland typedef enum { 48*5c51f124SMoriah Waterland HTTP_REQ_TYPE_HEAD, 49*5c51f124SMoriah Waterland HTTP_REQ_TYPE_GET 50*5c51f124SMoriah Waterland } HTTPRequestType; 51*5c51f124SMoriah Waterland 52*5c51f124SMoriah Waterland typedef enum { 53*5c51f124SMoriah Waterland OCSPSuccess, 54*5c51f124SMoriah Waterland OCSPMem, 55*5c51f124SMoriah Waterland OCSPParse, 56*5c51f124SMoriah Waterland OCSPConnect, 57*5c51f124SMoriah Waterland OCSPRequest, 58*5c51f124SMoriah Waterland OCSPResponder, 59*5c51f124SMoriah Waterland OCSPUnsupported, 60*5c51f124SMoriah Waterland OCSPVerify, 61*5c51f124SMoriah Waterland OCSPInternal, 62*5c51f124SMoriah Waterland OCSPNoURI 63*5c51f124SMoriah Waterland } OCSPStatus; 64*5c51f124SMoriah Waterland 65*5c51f124SMoriah Waterland typedef enum { 66*5c51f124SMoriah Waterland none, 67*5c51f124SMoriah Waterland web_http, 68*5c51f124SMoriah Waterland web_https, 69*5c51f124SMoriah Waterland web_ftp 70*5c51f124SMoriah Waterland } WebScheme; 71*5c51f124SMoriah Waterland 72*5c51f124SMoriah Waterland typedef enum { 73*5c51f124SMoriah Waterland WEB_OK, 74*5c51f124SMoriah Waterland WEB_TIMEOUT, 75*5c51f124SMoriah Waterland WEB_CONNREFUSED, 76*5c51f124SMoriah Waterland WEB_HOSTDOWN, 77*5c51f124SMoriah Waterland WEB_VERIFY_SETUP, 78*5c51f124SMoriah Waterland WEB_NOCONNECT, 79*5c51f124SMoriah Waterland WEB_GET_FAIL 80*5c51f124SMoriah Waterland } WebStatus; 81*5c51f124SMoriah Waterland 82*5c51f124SMoriah Waterland typedef struct { 83*5c51f124SMoriah Waterland ulong_t prev_cont_length; 84*5c51f124SMoriah Waterland ulong_t content_length; 85*5c51f124SMoriah Waterland ulong_t cur_pos; 86*5c51f124SMoriah Waterland } DwnldData; 87*5c51f124SMoriah Waterland 88*5c51f124SMoriah Waterland typedef struct { 89*5c51f124SMoriah Waterland keystore_handle_t keystore; 90*5c51f124SMoriah Waterland char *certfile; 91*5c51f124SMoriah Waterland char *uniqfile; 92*5c51f124SMoriah Waterland char *link; 93*5c51f124SMoriah Waterland char *errstr; 94*5c51f124SMoriah Waterland char *dwnld_dir; 95*5c51f124SMoriah Waterland boolean_t spool; 96*5c51f124SMoriah Waterland void *content; 97*5c51f124SMoriah Waterland int timeout; 98*5c51f124SMoriah Waterland url_hport_t proxy; 99*5c51f124SMoriah Waterland url_t url; 100*5c51f124SMoriah Waterland DwnldData data; 101*5c51f124SMoriah Waterland http_respinfo_t *resp; 102*5c51f124SMoriah Waterland boot_http_ver_t *http_vers; 103*5c51f124SMoriah Waterland http_handle_t *hps; 104*5c51f124SMoriah Waterland } WEB_SESSION; 105*5c51f124SMoriah Waterland 106*5c51f124SMoriah Waterland extern boolean_t web_session_control(PKG_ERR *, char *, char *, 107*5c51f124SMoriah Waterland keystore_handle_t, char *, ushort_t, int, int, int, char **); 108*5c51f124SMoriah Waterland extern boolean_t get_signature(PKG_ERR *, char *, struct pkgdev *, 109*5c51f124SMoriah Waterland PKCS7 **); 110*5c51f124SMoriah Waterland extern boolean_t validate_signature(PKG_ERR *, char *, BIO *, PKCS7 *, 111*5c51f124SMoriah Waterland STACK_OF(X509) *, url_hport_t *, int); 112*5c51f124SMoriah Waterland extern boolean_t ds_validate_signature(PKG_ERR *, struct pkgdev *, char **, 113*5c51f124SMoriah Waterland char *, PKCS7 *, STACK_OF(X509) *, url_hport_t *, int); 114*5c51f124SMoriah Waterland extern boolean_t get_proxy_port(PKG_ERR *, char **, ushort_t *); 115*5c51f124SMoriah Waterland extern boolean_t path_valid(char *); 116*5c51f124SMoriah Waterland extern void web_cleanup(void); 117*5c51f124SMoriah Waterland extern ushort_t strip_port(char *proxy); 118*5c51f124SMoriah Waterland extern void set_web_install(void); 119*5c51f124SMoriah Waterland extern int is_web_install(void); 120*5c51f124SMoriah Waterland extern void echo_out(int, char *, ...); 121*5c51f124SMoriah Waterland extern void backoff(void); 122*5c51f124SMoriah Waterland extern void reset_backoff(void); 123*5c51f124SMoriah Waterland extern char *get_endof_string(char *, char); 124*5c51f124SMoriah Waterland extern char *get_startof_string(char *, char); 125*5c51f124SMoriah Waterland 126*5c51f124SMoriah Waterland #ifdef __cplusplus 127*5c51f124SMoriah Waterland } 128*5c51f124SMoriah Waterland #endif 129*5c51f124SMoriah Waterland 130*5c51f124SMoriah Waterland #endif /* _PKGWEB_H */ 131