iPXE
https.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25FILE_SECBOOT ( PERMITTED );
26
27/**
28 * @file
29 *
30 * Secure Hyper Text Transfer Protocol (HTTPS)
31 *
32 */
33
34#include <ipxe/open.h>
35#include <ipxe/uri.h>
36#include <ipxe/tls.h>
37#include <ipxe/http.h>
38#include <ipxe/features.h>
39
41
42/**
43 * Add HTTPS filter
44 *
45 * @v conn HTTP connection
46 * @ret rc Return status code
47 */
48static int https_filter ( struct http_connection *conn ) {
49
50 return add_tls ( &conn->socket, conn->uri->host, NULL, NULL );
51}
52
53/** HTTPS URI opener */
54struct uri_opener https_uri_opener __uri_opener = {
55 .scheme = "https",
56 .open = http_open_uri,
57};
58
59/** HTTP URI scheme */
60struct http_scheme https_scheme __http_scheme = {
61 .name = "https",
62 .port = HTTPS_PORT,
63 .filter = https_filter,
64};
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define DHCP_EB_FEATURE_HTTPS
HTTPS protocol.
Definition features.h:41
#define FEATURE_PROTOCOL
Network protocols.
Definition features.h:22
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
Hyper Text Transport Protocol.
#define HTTPS_PORT
HTTPS default port.
Definition http.h:38
#define __http_scheme
Declare an HTTP scheme.
Definition http.h:58
int http_open_uri(struct interface *xfer, struct uri *uri)
Open HTTP transaction for simple URI.
Definition httpcore.c:1984
static int https_filter(struct http_connection *conn)
Add HTTPS filter.
Definition https.c:48
Feature list.
#define FEATURE(category, text, feature_opt, version)
Declare a feature.
Definition features.h:101
Data transfer interface opening.
#define __uri_opener
Register a URI opener.
Definition open.h:68
An HTTP connection.
Definition http.h:72
struct interface socket
Transport layer interface.
Definition http.h:85
struct uri * uri
Connection URI.
Definition http.h:81
An HTTP URI scheme.
Definition http.h:41
A URI opener.
Definition open.h:48
const char * host
Host name.
Definition uri.h:77
int add_tls(struct interface *xfer, const char *name, struct x509_root *root, struct private_key *key)
Add TLS on an interface.
Definition tls.c:3962
Transport Layer Security Protocol.
Uniform Resource Identifiers.