iPXE
Data Structures | Macros | Functions | Variables
uri_test.c File Reference

URI self-tests. More...

#include <string.h>
#include <byteswap.h>
#include <ipxe/uri.h>
#include <ipxe/tcpip.h>
#include <ipxe/params.h>
#include <ipxe/test.h>

Go to the source code of this file.

Data Structures

struct  uri_test
 A URI parsing/formatting test. More...
 
struct  uri_port_test
 A URI port number test. More...
 
struct  uri_resolve_test
 A URI or path resolution test. More...
 
struct  uri_pxe_test
 A PXE URI test. More...
 
struct  uri_churi_test
 A current working URI test. More...
 
struct  uri_params_test_list
 A form parameter URI test list. More...
 
struct  uri_params_test
 A form parameter URI test. More...
 

Macros

#define uri_ok(uri, expected)   uri_okx ( uri, expected, __FILE__, __LINE__ )
 
#define uri_parse_ok(test)   uri_parse_okx ( test, __FILE__, __LINE__ )
 
#define uri_format_ok(test)   uri_format_okx ( test, __FILE__, __LINE__ )
 
#define uri_dup_ok(test)   uri_dup_okx ( test, __FILE__, __LINE__ )
 
#define uri_parse_format_dup_ok(test)   uri_parse_format_dup_okx ( test, __FILE__, __LINE__ )
 
#define uri_port_ok(test)   uri_port_okx ( test, __FILE__, __LINE__ )
 
#define uri_resolve_ok(test)   uri_resolve_okx ( test, __FILE__, __LINE__ )
 
#define uri_resolve_path_ok(test)   uri_resolve_path_okx ( test, __FILE__, __LINE__ )
 
#define uri_pxe_ok(test)   uri_pxe_okx ( test, __FILE__, __LINE__ )
 
#define uri_churi_ok(test)   uri_churi_okx ( test, __FILE__, __LINE__ )
 
#define uri_params_list_ok(test)   uri_params_list_okx ( test, __FILE__, __LINE__ )
 
#define uri_params_ok(test)   uri_params_okx ( test, __FILE__, __LINE__ )
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int uristrcmp (const char *first, const char *second)
 Compare two URI component strings. More...
 
static void uri_okx (struct uri *uri, struct uri *expected, const char *file, unsigned int line)
 Report URI equality test result. More...
 
static void uri_parse_okx (struct uri_test *test, const char *file, unsigned int line)
 Report URI parsing test result. More...
 
static void uri_format_okx (struct uri_test *test, const char *file, unsigned int line)
 Report URI formatting test result. More...
 
static void uri_dup_okx (struct uri *uri, const char *file, unsigned int line)
 Report URI duplication test result. More...
 
static void uri_parse_format_dup_okx (struct uri_test *test, const char *file, unsigned int line)
 Report URI combined parsing and formatting test result. More...
 
static void uri_port_okx (struct uri_port_test *test, const char *file, unsigned int line)
 Report URI port number test result. More...
 
static void uri_resolve_okx (struct uri_resolve_test *test, const char *file, unsigned int line)
 Report URI resolution test result. More...
 
static void uri_resolve_path_okx (struct uri_resolve_test *test, const char *file, unsigned int line)
 Report path resolution test result. More...
 
static void uri_pxe_okx (struct uri_pxe_test *test, const char *file, unsigned int line)
 Report URI PXE test result. More...
 
static void uri_churi_okx (struct uri_churi_test *test, const char *file, unsigned int line)
 Report current working URI test result. More...
 
static void uri_params_list_okx (struct uri_params_test *test, struct uri *uri, const char *file, unsigned int line)
 Report form parameter URI test list result. More...
 
static void uri_params_okx (struct uri_params_test *test, const char *file, unsigned int line)
 Report form parameter URI test result. More...
 
static void uri_test_exec (void)
 Perform URI self-test. More...
 

Variables

static struct uri_test uri_empty
 Empty URI. More...
 
static struct uri_test uri_boot_ipxe_org
 Basic HTTP URI. More...
 
static struct uri_test uri_mailto
 Basic opaque URI. More...
 
static struct uri_test uri_path
 Basic path-only URI. More...
 
static struct uri_test uri_path_escaped
 Path-only URI with escaped characters. More...
 
static struct uri_test uri_http_all
 HTTP URI with all the trimmings. More...
 
static struct uri_test uri_http_escaped
 HTTP URI with escaped characters. More...
 
static struct uri_test uri_http_escaped_improper
 HTTP URI with improperly escaped characters. More...
 
static struct uri_test uri_ipv6
 IPv6 URI. More...
 
static struct uri_test uri_ipv6_port
 IPv6 URI with port. More...
 
static struct uri_test uri_ipv6_local
 IPv6 URI with link-local address. More...
 
static struct uri_test uri_ipv6_local_non_conforming
 IPv6 URI with link-local address not conforming to RFC 6874. More...
 
static struct uri_test uri_iscsi
 iSCSI URI More...
 
static struct uri_test uri_file_relative
 File URI with relative (opaque) path. More...
 
static struct uri_test uri_file_absolute
 File URI with absolute path. More...
 
static struct uri_test uri_file_volume
 File URI with volume name. More...
 
static struct uri_port_test uri_explicit_port
 URI with port number. More...
 
static struct uri_port_test uri_default_port
 URI without port number. More...
 
static struct uri_resolve_test uri_simple_path
 Simple path resolution test. More...
 
static struct uri_resolve_test uri_relative_path
 Path resolution test with "." and ".." elements. More...
 
static struct uri_resolve_test uri_directory_path
 Path resolution test terminating with directory. More...
 
static struct uri_resolve_test uri_excessive_path
 Path resolution test with excessive ".." elements. More...
 
static struct uri_resolve_test uri_absolute_path
 Path resolution test with absolute path. More...
 
static struct uri_resolve_test uri_relative
 Relative URI resolution test. More...
 
static struct uri_resolve_test uri_absolute
 Absolute URI resolution test. More...
 
static struct uri_resolve_test uri_absolute_uri_path
 Absolute path URI resolution test. More...
 
static struct uri_resolve_test uri_query
 Query URI resolution test. More...
 
static struct uri_resolve_test uri_fragment
 Fragment URI resolution test. More...
 
static struct uri_pxe_test uri_pxe_absolute
 PXE URI with absolute URI. More...
 
static struct uri_pxe_test uri_pxe_absolute_path
 PXE URI with absolute path. More...
 
static struct uri_pxe_test uri_pxe_relative_path
 PXE URI with relative path. More...
 
static struct uri_pxe_test uri_pxe_icky
 PXE URI with path containing special characters. More...
 
static struct uri_pxe_test uri_pxe_port
 PXE URI with custom port. More...
 
static struct uri_churi_test uri_churi []
 Current working URI test. More...
 
static struct uri_params_test_list uri_params_list []
 Form parameter URI test list. More...
 
static struct uri_params_test uri_params
 Form parameter URI test. More...
 
static struct uri_params_test_list uri_named_params_list []
 Named form parameter URI test list. More...
 
static struct uri_params_test uri_named_params
 Named form parameter URI test. More...
 
struct self_test uri_test __self_test
 URI self-test. More...
 

Detailed Description

URI self-tests.

Definition in file uri_test.c.

Macro Definition Documentation

◆ uri_ok

#define uri_ok (   uri,
  expected 
)    uri_okx ( uri, expected, __FILE__, __LINE__ )

Definition at line 156 of file uri_test.c.

◆ uri_parse_ok

#define uri_parse_ok (   test)    uri_parse_okx ( test, __FILE__, __LINE__ )

Definition at line 176 of file uri_test.c.

◆ uri_format_ok

#define uri_format_ok (   test)    uri_format_okx ( test, __FILE__, __LINE__ )

Definition at line 203 of file uri_test.c.

◆ uri_dup_ok

#define uri_dup_ok (   test)    uri_dup_okx ( test, __FILE__, __LINE__ )

Definition at line 222 of file uri_test.c.

◆ uri_parse_format_dup_ok

#define uri_parse_format_dup_ok (   test)    uri_parse_format_dup_okx ( test, __FILE__, __LINE__ )

Definition at line 238 of file uri_test.c.

◆ uri_port_ok

#define uri_port_ok (   test)    uri_port_okx ( test, __FILE__, __LINE__ )

Definition at line 262 of file uri_test.c.

◆ uri_resolve_ok

#define uri_resolve_ok (   test)    uri_resolve_okx ( test, __FILE__, __LINE__ )

Definition at line 303 of file uri_test.c.

◆ uri_resolve_path_ok

#define uri_resolve_path_ok (   test)    uri_resolve_path_okx ( test, __FILE__, __LINE__ )

Definition at line 326 of file uri_test.c.

◆ uri_pxe_ok

#define uri_pxe_ok (   test)    uri_pxe_okx ( test, __FILE__, __LINE__ )

Definition at line 353 of file uri_test.c.

◆ uri_churi_ok

#define uri_churi_ok (   test)    uri_churi_okx ( test, __FILE__, __LINE__ )

Definition at line 401 of file uri_test.c.

◆ uri_params_list_ok

#define uri_params_list_ok (   test)    uri_params_list_okx ( test, __FILE__, __LINE__ )

Definition at line 434 of file uri_test.c.

◆ uri_params_ok

#define uri_params_ok (   test)    uri_params_okx ( test, __FILE__, __LINE__ )

Definition at line 483 of file uri_test.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ uristrcmp()

static int uristrcmp ( const char *  first,
const char *  second 
)
static

Compare two URI component strings.

Parameters
firstFirst string, or NULL
secondSecond string, or NULL
differenceDifference

Definition at line 122 of file uri_test.c.

122  {
123 
124  /* Compare strings, allowing for either to be NULL */
125  if ( first == second ) {
126  return 0;
127  } else if ( ( first == NULL ) || ( second == NULL ) ) {
128  return -1;
129  } else {
130  return strcmp ( first, second );
131  }
132 }
static __always_inline int off_t userptr_t second
Definition: efi_uaccess.h:80
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
uint32_t first
Length to skip in first segment.
Definition: pccrc.h:23

References first, NULL, second, and strcmp().

Referenced by uri_okx().

◆ uri_okx()

static void uri_okx ( struct uri uri,
struct uri expected,
const char *  file,
unsigned int  line 
)
static

Report URI equality test result.

Parameters
uriURI
expectedExpected URI
fileTest code file
lineTest code line

Definition at line 142 of file uri_test.c.

143  {
144 
145  okx ( uristrcmp ( uri->scheme, expected->scheme ) == 0, file, line );
146  okx ( uristrcmp ( uri->opaque, expected->opaque ) == 0, file, line );
147  okx ( uristrcmp ( uri->user, expected->user ) == 0, file, line );
148  okx ( uristrcmp ( uri->password, expected->password ) == 0, file, line);
149  okx ( uristrcmp ( uri->host, expected->host ) == 0, file, line );
150  okx ( uristrcmp ( uri->port, expected->port ) == 0, file, line );
151  okx ( uristrcmp ( uri->path, expected->path ) == 0, file, line );
152  okx ( uristrcmp ( uri->query, expected->query ) == 0, file, line );
153  okx ( uristrcmp ( uri->fragment, expected->fragment ) == 0, file, line);
154  okx ( uri->params == expected->params, file, line );
155 }
const char * port
Port number.
Definition: uri.h:64
const char * scheme
Scheme.
Definition: uri.h:54
#define okx(success, file, line)
Report test result.
Definition: test.h:44
const char * path
Path.
Definition: uri.h:66
struct parameters * params
Form parameters.
Definition: uri.h:72
const char * host
Host name.
Definition: uri.h:62
const char * query
Query.
Definition: uri.h:68
const char * opaque
Opaque part.
Definition: uri.h:56
const char * fragment
Fragment.
Definition: uri.h:70
const char * password
Password.
Definition: uri.h:60
const char * user
User name.
Definition: uri.h:58
A Uniform Resource Identifier.
Definition: uri.h:50
static int uristrcmp(const char *first, const char *second)
Compare two URI component strings.
Definition: uri_test.c:122

References uri::fragment, uri::host, okx, uri::opaque, uri::params, uri::password, uri::path, uri::port, uri::query, uri::scheme, uristrcmp(), and uri::user.

Referenced by uri_dup_okx(), uri_params_list_okx(), uri_parse_okx(), and uri_pxe_okx().

◆ uri_parse_okx()

static void uri_parse_okx ( struct uri_test test,
const char *  file,
unsigned int  line 
)
static

Report URI parsing test result.

Parameters
testURI test
fileTest code file
lineTest code line

Definition at line 165 of file uri_test.c.

166  {
167  struct uri *uri;
168 
169  /* Parse URI */
170  uri = parse_uri ( test->string );
171  okx ( uri != NULL, file, line );
172  if ( uri )
173  uri_okx ( uri, &test->uri, file, line );
174  uri_put ( uri );
175 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
static void uri_okx(struct uri *uri, struct uri *expected, const char *file, unsigned int line)
Report URI equality test result.
Definition: uri_test.c:142
#define okx(success, file, line)
Report test result.
Definition: test.h:44
A Uniform Resource Identifier.
Definition: uri.h:50
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73
struct uri * parse_uri(const char *uri_string)
Parse URI.
Definition: uri.c:295

References NULL, okx, parse_uri(), test, uri_okx(), and uri_put().

Referenced by uri_parse_format_dup_okx().

◆ uri_format_okx()

static void uri_format_okx ( struct uri_test test,
const char *  file,
unsigned int  line 
)
static

Report URI formatting test result.

Parameters
testURI test
fileTest code file
lineTest code line

Definition at line 185 of file uri_test.c.

186  {
187  char buf[ strlen ( test->string ) + 1 /* NUL */ ];
188  char *tmp;
189  size_t len;
190 
191  /* Format into fixed-size buffer */
192  len = format_uri ( &test->uri, buf, sizeof ( buf ) );
193  okx ( len == ( sizeof ( buf ) - 1 /* NUL */ ), file, line );
194  okx ( strcmp ( buf, test->string ) == 0, file, line );
195 
196  /* Format into temporarily allocated buffer */
197  tmp = format_uri_alloc ( &test->uri );
198  okx ( tmp != NULL, file, line );
199  if ( tmp )
200  okx ( strcmp ( tmp, test->string ) == 0, file, line );
201  free ( tmp );
202 }
#define okx(success, file, line)
Report test result.
Definition: test.h:44
size_t format_uri(const struct uri *uri, char *buf, size_t len)
Format URI.
Definition: uri.c:457
char * format_uri_alloc(const struct uri *uri)
Format URI.
Definition: uri.c:522
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
uint8_t * tmp
Definition: entropy.h:156
size_t strlen(const char *src)
Get length of string.
Definition: string.c:213
uint32_t len
Length.
Definition: ena.h:14
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73

References format_uri(), format_uri_alloc(), free, len, NULL, okx, strcmp(), strlen(), test, and tmp.

Referenced by uri_parse_format_dup_okx().

◆ uri_dup_okx()

static void uri_dup_okx ( struct uri uri,
const char *  file,
unsigned int  line 
)
static

Report URI duplication test result.

Parameters
testURI
fileTest code file
lineTest code line

Definition at line 212 of file uri_test.c.

213  {
214  struct uri *dup;
215 
216  dup = uri_dup ( uri );
217  okx ( dup != NULL, file, line );
218  if ( dup )
219  uri_okx ( dup, uri, file, line );
220  uri_put ( dup );
221 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
static void uri_okx(struct uri *uri, struct uri *expected, const char *file, unsigned int line)
Report URI equality test result.
Definition: uri_test.c:142
#define okx(success, file, line)
Report test result.
Definition: test.h:44
struct uri * uri_dup(const struct uri *uri)
Duplicate URI.
Definition: uri.c:576
A Uniform Resource Identifier.
Definition: uri.h:50
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References NULL, okx, uri_dup(), uri_okx(), and uri_put().

Referenced by uri_parse_format_dup_okx().

◆ uri_parse_format_dup_okx()

static void uri_parse_format_dup_okx ( struct uri_test test,
const char *  file,
unsigned int  line 
)
static

Report URI combined parsing and formatting test result.

Parameters
testURI test
fileTest code file
lineTest code line

Definition at line 231 of file uri_test.c.

232  {
233 
234  uri_parse_okx ( test, file, line );
235  uri_format_okx ( test, file, line );
236  uri_dup_okx ( &test->uri, file, line );
237 }
static void uri_format_okx(struct uri_test *test, const char *file, unsigned int line)
Report URI formatting test result.
Definition: uri_test.c:185
static void uri_dup_okx(struct uri *uri, const char *file, unsigned int line)
Report URI duplication test result.
Definition: uri_test.c:212
static int test
Definition: epic100.c:73
static void uri_parse_okx(struct uri_test *test, const char *file, unsigned int line)
Report URI parsing test result.
Definition: uri_test.c:165

References test, uri_dup_okx(), uri_format_okx(), and uri_parse_okx().

◆ uri_port_okx()

static void uri_port_okx ( struct uri_port_test test,
const char *  file,
unsigned int  line 
)
static

Report URI port number test result.

Parameters
testURI port number test
fileTest code file
lineTest code line

Definition at line 248 of file uri_test.c.

249  {
250  struct uri *uri;
251  unsigned int port;
252 
253  /* Parse URI */
254  uri = parse_uri ( test->string );
255  okx ( uri != NULL, file, line );
256  if ( uri ) {
257  port = uri_port ( uri, test->default_port );
258  okx ( port == test->port, file, line );
259  }
260  uri_put ( uri );
261 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
u8 port
Port number.
Definition: CIB_PRM.h:31
#define okx(success, file, line)
Report test result.
Definition: test.h:44
unsigned int uri_port(const struct uri *uri, unsigned int default_port)
Get port from URI.
Definition: uri.c:441
A Uniform Resource Identifier.
Definition: uri.h:50
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73
struct uri * parse_uri(const char *uri_string)
Parse URI.
Definition: uri.c:295

References NULL, okx, parse_uri(), port, test, uri_port(), and uri_put().

◆ uri_resolve_okx()

static void uri_resolve_okx ( struct uri_resolve_test test,
const char *  file,
unsigned int  line 
)
static

Report URI resolution test result.

Parameters
testPath resolution test
fileTest code file
lineTest code line

Definition at line 271 of file uri_test.c.

272  {
273  struct uri *base;
274  struct uri *relative;
275  struct uri *resolved = NULL;
276  char *formatted;
277 
278  /* Parse URIs */
279  base = parse_uri ( test->base );
280  okx ( base != NULL, file, line );
281  relative = parse_uri ( test->relative );
282  okx ( relative != NULL, file, line );
283 
284  /* Resolve URI */
285  if ( base && relative ) {
286  resolved = resolve_uri ( base, relative );
287  okx ( resolved != NULL, file, line );
288  }
289 
290  /* Format resolved URI */
291  formatted = format_uri_alloc ( resolved );
292  okx ( formatted != NULL, file, line );
293 
294  /* Check resolved URI */
295  if ( formatted )
296  okx ( strcmp ( formatted, test->resolved ) == 0, file, line );
297 
298  free ( formatted );
299  uri_put ( resolved );
300  uri_put ( relative );
301  uri_put ( base );
302 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
#define okx(success, file, line)
Report test result.
Definition: test.h:44
char * format_uri_alloc(const struct uri *uri)
Format URI.
Definition: uri.c:522
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
uint16_t base
Base address.
Definition: edd.h:14
uint8_t formatted[5]
Formatted area.
Definition: smbios.h:29
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
A Uniform Resource Identifier.
Definition: uri.h:50
struct uri * resolve_uri(const struct uri *base_uri, struct uri *relative_uri)
Resolve base+relative URI.
Definition: uri.c:676
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73
struct uri * parse_uri(const char *uri_string)
Parse URI.
Definition: uri.c:295

References base, format_uri_alloc(), formatted, free, NULL, okx, parse_uri(), resolve_uri(), strcmp(), test, and uri_put().

Referenced by uri_resolve_path_okx().

◆ uri_resolve_path_okx()

static void uri_resolve_path_okx ( struct uri_resolve_test test,
const char *  file,
unsigned int  line 
)
static

Report path resolution test result.

Parameters
testPath resolution test
fileTest code file
lineTest code line

Definition at line 312 of file uri_test.c.

313  {
314  char *resolved;
315 
316  /* Resolve paths using resolve_path() directly */
317  resolved = resolve_path ( test->base, test->relative );
318  okx ( resolved != NULL, file, line );
319  if ( resolved )
320  okx ( strcmp ( resolved, test->resolved ) == 0, file, line );
321  free ( resolved );
322 
323  /* Resolve paths as URIs (since all paths are valid URIs) */
324  uri_resolve_okx ( test, file, line );
325 }
static void uri_resolve_okx(struct uri_resolve_test *test, const char *file, unsigned int line)
Report URI resolution test result.
Definition: uri_test.c:271
#define okx(success, file, line)
Report test result.
Definition: test.h:44
char * resolve_path(const char *base_path, const char *relative_path)
Resolve base+relative path.
Definition: uri.c:614
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73

References free, NULL, okx, resolve_path(), strcmp(), test, and uri_resolve_okx().

◆ uri_pxe_okx()

static void uri_pxe_okx ( struct uri_pxe_test test,
const char *  file,
unsigned int  line 
)
static

Report URI PXE test result.

Parameters
testURI PXE test
fileTest code file
lineTest code line

Definition at line 336 of file uri_test.c.

337  {
338  char buf[ strlen ( test->string ) + 1 /* NUL */ ];
339  struct uri *uri;
340  size_t len;
341 
342  /* Construct URI */
343  uri = pxe_uri ( &test->server.sa, test->filename );
344  okx ( uri != NULL, file, line );
345  if ( uri ) {
346  uri_okx ( uri, &test->uri, file, line );
347  len = format_uri ( uri, buf, sizeof ( buf ) );
348  okx ( len == ( sizeof ( buf ) - 1 /* NUL */ ), file, line );
349  okx ( strcmp ( buf, test->string ) == 0, file, line );
350  }
351  uri_put ( uri );
352 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
struct uri * pxe_uri(struct sockaddr *sa_server, const char *filename)
Construct URI from server address and filename.
Definition: uri.c:774
static void uri_okx(struct uri *uri, struct uri *expected, const char *file, unsigned int line)
Report URI equality test result.
Definition: uri_test.c:142
#define okx(success, file, line)
Report test result.
Definition: test.h:44
size_t format_uri(const struct uri *uri, char *buf, size_t len)
Format URI.
Definition: uri.c:457
size_t strlen(const char *src)
Get length of string.
Definition: string.c:213
uint32_t len
Length.
Definition: ena.h:14
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
A Uniform Resource Identifier.
Definition: uri.h:50
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73

References format_uri(), len, NULL, okx, pxe_uri(), strcmp(), strlen(), test, uri_okx(), and uri_put().

◆ uri_churi_okx()

static void uri_churi_okx ( struct uri_churi_test test,
const char *  file,
unsigned int  line 
)
static

Report current working URI test result.

Parameters
testsList of current working URI tests
fileTest code file
lineTest code line

Definition at line 362 of file uri_test.c.

363  {
364  struct uri *old_cwuri;
365  struct uri *uri;
366  char *formatted;
367 
368  /* Preserve original current working URI */
369  old_cwuri = uri_get ( cwuri );
370 
371  /* Perform sequence of current working URI changes */
372  do {
373  /* Parse relative URI */
374  uri = parse_uri ( test->relative );
375  okx ( uri != NULL, file, line );
376 
377  /* Move to this URI */
378  churi ( uri );
379 
380  /* Format new current working URI */
382  okx ( formatted != NULL, file, line );
383  if ( formatted ) {
384  okx ( strcmp ( formatted, test->expected ) == 0,
385  file, line );
386  }
387 
388  /* Free temporary storage */
389  free ( formatted );
390  uri_put ( uri );
391 
392  /* Move to next current working URI test */
393  test++;
394 
395  } while ( test->relative != NULL );
396 
397  /* Restore original current working URI */
398  churi ( old_cwuri );
399  uri_put ( old_cwuri );
400 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
static struct uri * uri_get(struct uri *uri)
Increment URI reference count.
Definition: uri.h:177
#define okx(success, file, line)
Report test result.
Definition: test.h:44
void churi(struct uri *uri)
Change working URI.
Definition: cwuri.c:45
char * format_uri_alloc(const struct uri *uri)
Format URI.
Definition: uri.c:522
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
uint8_t formatted[5]
Formatted area.
Definition: smbios.h:29
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
A Uniform Resource Identifier.
Definition: uri.h:50
struct uri * cwuri
Current working URI.
Definition: cwuri.c:38
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73
struct uri * parse_uri(const char *uri_string)
Parse URI.
Definition: uri.c:295

References churi(), cwuri, format_uri_alloc(), formatted, free, NULL, okx, parse_uri(), strcmp(), test, uri_get(), and uri_put().

◆ uri_params_list_okx()

static void uri_params_list_okx ( struct uri_params_test test,
struct uri uri,
const char *  file,
unsigned int  line 
)
static

Report form parameter URI test list result.

Parameters
testForm parameter URI test
uriURI
fileTest code file
lineTest code line

Definition at line 411 of file uri_test.c.

413  {
414  struct uri_params_test_list *list;
415  struct parameter *param;
416 
417  /* Check URI */
418  uri_okx ( uri, &test->uri, file, line );
419 
420  /* Check URI parameters */
421  okx ( uri->params != NULL, file, line );
422  if ( uri->params ) {
423  list = test->list;
425  okx ( strcmp ( param->key, list->key ) == 0,
426  file, line );
427  okx ( strcmp ( param->value, list->value ) == 0,
428  file, line );
429  list++;
430  }
431  okx ( list->key == NULL, file, line );
432  }
433 }
#define for_each_param(param, params)
Iterate over all form parameters in a list.
Definition: params.h:75
static void uri_okx(struct uri *uri, struct uri *expected, const char *file, unsigned int line)
Report URI equality test result.
Definition: uri_test.c:142
#define okx(success, file, line)
Report test result.
Definition: test.h:44
struct parameters * params
Form parameters.
Definition: uri.h:72
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
struct list_head list
List of form parameters.
Definition: params.h:30
int strcmp(const char *first, const char *second)
Compare strings.
Definition: string.c:157
A Uniform Resource Identifier.
Definition: uri.h:50
A form parameter.
Definition: params.h:28
A form parameter URI test list.
Definition: uri_test.c:96
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73

References for_each_param, parameter::list, NULL, okx, param, uri::params, strcmp(), test, and uri_okx().

Referenced by uri_params_okx().

◆ uri_params_okx()

static void uri_params_okx ( struct uri_params_test test,
const char *  file,
unsigned int  line 
)
static

Report form parameter URI test result.

Parameters
testForm parameter URI test
fileTest code file
lineTest code line

Definition at line 444 of file uri_test.c.

445  {
446  struct uri_params_test_list *list;
447  struct parameters *params;
448  struct parameter *param;
449  struct uri *uri;
450  struct uri *dup;
451 
452  /* Create parameter list */
453  params = create_parameters ( test->name );
454  okx ( params != NULL, file, line );
455  if ( params ) {
456  for ( list = test->list ; list->key ; list++ ) {
457  param = add_parameter ( params, list->key, list->value);
458  okx ( param != NULL, file, line );
459  }
460  }
461 
462  /* Record parameter list as part of expected URI */
463  test->uri.params = params;
464 
465  /* Parse URI */
466  uri = parse_uri ( test->string );
467  okx ( uri != NULL, file, line );
468  if ( uri )
469  uri_params_list_okx ( test, uri, file, line );
470 
471  /* Duplicate URI */
472  dup = uri_dup ( uri );
473  okx ( dup != NULL, file, line );
474  if ( dup )
475  uri_params_list_okx ( test, dup, file, line );
476 
477  /* Clear parameter list in expected URI */
478  test->uri.params = NULL;
479 
480  uri_put ( uri );
481  uri_put ( dup );
482 }
static void uri_put(struct uri *uri)
Decrement URI reference count.
Definition: uri.h:188
const char * value
Value.
Definition: uri_test.c:100
A form parameter list.
Definition: params.h:16
const char * key
Key.
Definition: uri_test.c:98
#define okx(success, file, line)
Report test result.
Definition: test.h:44
struct parameter * add_parameter(struct parameters *params, const char *key, const char *value)
Add form parameter.
Definition: params.c:128
static void uri_params_list_okx(struct uri_params_test *test, struct uri *uri, const char *file, unsigned int line)
Report form parameter URI test list result.
Definition: uri_test.c:411
struct parameters * create_parameters(const char *name)
Create form parameter list.
Definition: params.c:86
struct parameters * params
Form parameters.
Definition: uri.h:72
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
struct uri * uri_dup(const struct uri *uri)
Duplicate URI.
Definition: uri.c:576
A Uniform Resource Identifier.
Definition: uri.h:50
A form parameter.
Definition: params.h:28
A form parameter URI test list.
Definition: uri_test.c:96
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static int test
Definition: epic100.c:73
struct uri * parse_uri(const char *uri_string)
Parse URI.
Definition: uri.c:295

References add_parameter(), create_parameters(), uri_params_test_list::key, NULL, okx, param, uri::params, parse_uri(), test, uri_dup(), uri_params_list_okx(), uri_put(), and uri_params_test_list::value.

◆ uri_test_exec()

static void uri_test_exec ( void  )
static

Perform URI self-test.

URI port number tests

Path resolution tests

URI resolution tests

Definition at line 914 of file uri_test.c.

914  {
915 
916  /* URI parsing, formatting, and duplication tests */
924  uri_parse_ok ( &uri_http_escaped_improper ); /* Parse only */
928  uri_parse_ok ( &uri_ipv6_local_non_conforming ); /* Parse only */
933 
934  /** URI port number tests */
937 
938  /** Path resolution tests */
944 
945  /** URI resolution tests */
951 
952  /* PXE URI construction tests */
958 
959  /* Current working URI tests */
961 
962  /* Form parameter URI tests */
965 }
static struct uri_test uri_ipv6_local
IPv6 URI with link-local address.
Definition: uri_test.c:580
static struct uri_test uri_ipv6
IPv6 URI.
Definition: uri_test.c:559
static struct uri_resolve_test uri_absolute
Absolute URI resolution test.
Definition: uri_test.c:698
static struct uri_port_test uri_explicit_port
URI with port number.
Definition: uri_test.c:642
static struct uri_pxe_test uri_pxe_relative_path
PXE URI with relative path.
Definition: uri_test.c:762
static struct uri_test uri_http_escaped
HTTP URI with escaped characters.
Definition: uri_test.c:530
static struct uri_test uri_empty
Empty URI.
Definition: uri_test.c:486
#define uri_parse_format_dup_ok(test)
Definition: uri_test.c:238
static struct uri_pxe_test uri_pxe_absolute
PXE URI with absolute URI.
Definition: uri_test.c:726
static struct uri_params_test uri_params
Form parameter URI test.
Definition: uri_test.c:870
static struct uri_test uri_file_volume
File URI with volume name.
Definition: uri_test.c:632
static struct uri_test uri_file_relative
File URI with relative (opaque) path.
Definition: uri_test.c:614
static struct uri_pxe_test uri_pxe_port
PXE URI with custom port.
Definition: uri_test.c:798
static struct uri_resolve_test uri_fragment
Fragment URI resolution test.
Definition: uri_test.c:719
#define uri_port_ok(test)
Definition: uri_test.c:262
static struct uri_resolve_test uri_query
Query URI resolution test.
Definition: uri_test.c:712
#define uri_resolve_ok(test)
Definition: uri_test.c:303
static struct uri_resolve_test uri_relative_path
Path resolution test with "." and ".." elements.
Definition: uri_test.c:663
static struct uri_resolve_test uri_absolute_path
Path resolution test with absolute path.
Definition: uri_test.c:684
static struct uri_test uri_boot_ipxe_org
Basic HTTP URI.
Definition: uri_test.c:491
static struct uri_resolve_test uri_directory_path
Path resolution test terminating with directory.
Definition: uri_test.c:670
static struct uri_test uri_iscsi
iSCSI URI
Definition: uri_test.c:605
static struct uri_test uri_http_escaped_improper
HTTP URI with improperly escaped characters.
Definition: uri_test.c:542
static struct uri_resolve_test uri_excessive_path
Path resolution test with excessive ".." elements.
Definition: uri_test.c:677
static struct uri_churi_test uri_churi[]
Current working URI test.
Definition: uri_test.c:818
static struct uri_test uri_http_all
HTTP URI with all the trimmings.
Definition: uri_test.c:515
static struct uri_test uri_ipv6_port
IPv6 URI with port.
Definition: uri_test.c:569
static struct uri_resolve_test uri_absolute_uri_path
Absolute path URI resolution test.
Definition: uri_test.c:705
static struct uri_params_test uri_named_params
Named form parameter URI test.
Definition: uri_test.c:898
#define uri_params_ok(test)
Definition: uri_test.c:483
static struct uri_test uri_path
Basic path-only URI.
Definition: uri_test.c:503
static struct uri_test uri_mailto
Basic opaque URI.
Definition: uri_test.c:497
static struct uri_resolve_test uri_relative
Relative URI resolution test.
Definition: uri_test.c:691
#define uri_churi_ok(test)
Definition: uri_test.c:401
static struct uri_pxe_test uri_pxe_absolute_path
PXE URI with absolute path.
Definition: uri_test.c:744
static struct uri_test uri_file_absolute
File URI with absolute path.
Definition: uri_test.c:623
#define uri_pxe_ok(test)
Definition: uri_test.c:353
static struct uri_test uri_path_escaped
Path-only URI with escaped characters.
Definition: uri_test.c:509
static struct uri_resolve_test uri_simple_path
Simple path resolution test.
Definition: uri_test.c:656
#define uri_resolve_path_ok(test)
Definition: uri_test.c:326
static struct uri_port_test uri_default_port
URI without port number.
Definition: uri_test.c:649
#define uri_parse_ok(test)
Definition: uri_test.c:176
static struct uri_pxe_test uri_pxe_icky
PXE URI with path containing special characters.
Definition: uri_test.c:780
static struct uri_test uri_ipv6_local_non_conforming
IPv6 URI with link-local address not conforming to RFC 6874.
Definition: uri_test.c:590

References uri_absolute, uri_absolute_path, uri_absolute_uri_path, uri_boot_ipxe_org, uri_churi, uri_churi_ok, uri_default_port, uri_directory_path, uri_empty, uri_excessive_path, uri_explicit_port, uri_file_absolute, uri_file_relative, uri_file_volume, uri_fragment, uri_http_all, uri_http_escaped, uri_http_escaped_improper, uri_ipv6, uri_ipv6_local, uri_ipv6_local_non_conforming, uri_ipv6_port, uri_iscsi, uri_mailto, uri_named_params, uri_params, uri_params_ok, uri_parse_format_dup_ok, uri_parse_ok, uri_path, uri_path_escaped, uri_port_ok, uri_pxe_absolute, uri_pxe_absolute_path, uri_pxe_icky, uri_pxe_ok, uri_pxe_port, uri_pxe_relative_path, uri_query, uri_relative, uri_relative_path, uri_resolve_ok, uri_resolve_path_ok, and uri_simple_path.

Variable Documentation

◆ uri_empty

struct uri_test uri_empty
static
Initial value:
= {
.string = "",
}

Empty URI.

Definition at line 486 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_boot_ipxe_org

struct uri_test uri_boot_ipxe_org
static
Initial value:
= {
"http://boot.ipxe.org/demo/boot.php",
{ .scheme = "http", .host = "boot.ipxe.org", .path = "/demo/boot.php" }
}

Basic HTTP URI.

Definition at line 491 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_mailto

struct uri_test uri_mailto
static
Initial value:
= {
"mailto:ipxe-devel@lists.ipxe.org",
{ .scheme = "mailto", .opaque = "ipxe-devel@lists.ipxe.org" }
}

Basic opaque URI.

Definition at line 497 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_path

struct uri_test uri_path
static
Initial value:
= {
"/var/lib/tftpboot/pxelinux.0",
{ .path = "/var/lib/tftpboot/pxelinux.0" },
}

Basic path-only URI.

Definition at line 503 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_path_escaped

struct uri_test uri_path_escaped
static
Initial value:
= {
"/hello%20world%3F",
{ .path = "/hello world?" },
}

Path-only URI with escaped characters.

Definition at line 509 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_http_all

struct uri_test uri_http_all
static
Initial value:
= {
"http://anon:password@example.com:3001/~foo/cgi-bin/foo.pl?a=b&c=d#bit",
{
.scheme = "http",
.user = "anon",
.password = "password",
.host = "example.com",
.port = "3001",
.path = "/~foo/cgi-bin/foo.pl",
.query = "a=b&c=d",
.fragment = "bit",
},
}

HTTP URI with all the trimmings.

Definition at line 515 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_http_escaped

struct uri_test uri_http_escaped
static
Initial value:
= {
"https://test.ipxe.org/wtf%3F%0A?kind%23of/uri%20is#this%3F",
{
.scheme = "https",
.host = "test.ipxe.org",
.path = "/wtf?\n",
.query = "kind#of/uri is",
.fragment = "this?",
},
}

HTTP URI with escaped characters.

Definition at line 530 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_http_escaped_improper

struct uri_test uri_http_escaped_improper
static
Initial value:
= {
"https://test%2eipxe.org/wt%66%3f\n?kind%23of/uri is#this?",
{
.scheme = "https",
.host = "test.ipxe.org",
.path = "/wtf?\n",
.query = "kind#of/uri is",
.fragment = "this?",
},
}

HTTP URI with improperly escaped characters.

Definition at line 542 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_ipv6

struct uri_test uri_ipv6
static
Initial value:
= {
"http://[2001:ba8:0:1d4::6950:5845]/",
{
.scheme = "http",
.host = "[2001:ba8:0:1d4::6950:5845]",
.path = "/",
},
}

IPv6 URI.

Definition at line 559 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_ipv6_port

struct uri_test uri_ipv6_port
static
Initial value:
= {
"http://[2001:ba8:0:1d4::6950:5845]:8001/boot",
{
.scheme = "http",
.host = "[2001:ba8:0:1d4::6950:5845]",
.port = "8001",
.path = "/boot",
},
}

IPv6 URI with port.

Definition at line 569 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_ipv6_local

struct uri_test uri_ipv6_local
static
Initial value:
= {
"http://[fe80::69ff:fe50:5845%25net0]/ipxe",
{
.scheme = "http",
.host = "[fe80::69ff:fe50:5845%net0]",
.path = "/ipxe",
},
}

IPv6 URI with link-local address.

Definition at line 580 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_ipv6_local_non_conforming

struct uri_test uri_ipv6_local_non_conforming
static
Initial value:
= {
"http://[fe80::69ff:fe50:5845%net0]/ipxe",
{
.scheme = "http",
.host = "[fe80::69ff:fe50:5845%net0]",
.path = "/ipxe",
},
}

IPv6 URI with link-local address not conforming to RFC 6874.

Definition at line 590 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_iscsi

struct uri_test uri_iscsi
static
Initial value:
= {
"iscsi:10.253.253.1::::iqn.2010-04.org.ipxe:rabbit",
{
.scheme = "iscsi",
.opaque = "10.253.253.1::::iqn.2010-04.org.ipxe:rabbit",
},
}

iSCSI URI

Definition at line 605 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_file_relative

struct uri_test uri_file_relative
static
Initial value:
= {
"file:boot/script.ipxe",
{
.scheme = "file",
.opaque = "boot/script.ipxe",
},
}

File URI with relative (opaque) path.

Definition at line 614 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_file_absolute

struct uri_test uri_file_absolute
static
Initial value:
= {
"file:/boot/script.ipxe",
{
.scheme = "file",
.path = "/boot/script.ipxe",
},
}

File URI with absolute path.

Definition at line 623 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_file_volume

struct uri_test uri_file_volume
static
Initial value:
= {
"file://hpilo/boot/script.ipxe",
{
.scheme = "file",
.host = "hpilo",
.path = "/boot/script.ipxe",
},
}

File URI with volume name.

Definition at line 632 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_explicit_port

struct uri_port_test uri_explicit_port
static
Initial value:
= {
"http://192.168.0.1:8080/boot.php",
80,
8080,
}

URI with port number.

Definition at line 642 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_default_port

struct uri_port_test uri_default_port
static
Initial value:
= {
"http://192.168.0.1/boot.php",
80,
80,
}

URI without port number.

Definition at line 649 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_simple_path

struct uri_resolve_test uri_simple_path
static
Initial value:
= {
"/etc/passwd",
"group",
"/etc/group",
}

Simple path resolution test.

Definition at line 656 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_relative_path

struct uri_resolve_test uri_relative_path
static
Initial value:
= {
"/var/lib/tftpboot/pxe/pxelinux.0",
"./../ipxe/undionly.kpxe",
"/var/lib/tftpboot/ipxe/undionly.kpxe",
}

Path resolution test with "." and ".." elements.

Definition at line 663 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_directory_path

struct uri_resolve_test uri_directory_path
static
Initial value:
= {
"/test/cgi-bin.pl/boot.ipxe",
"..",
"/test/",
}

Path resolution test terminating with directory.

Definition at line 670 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_excessive_path

struct uri_resolve_test uri_excessive_path
static
Initial value:
= {
"/var/lib/tftpboot/ipxe.pxe",
"../../../../../../../foo",
"/foo",
}

Path resolution test with excessive ".." elements.

Definition at line 677 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_absolute_path

struct uri_resolve_test uri_absolute_path
static
Initial value:
= {
"/var/lib/tftpboot",
"/etc/hostname",
"/etc/hostname",
}

Path resolution test with absolute path.

Definition at line 684 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_relative

struct uri_resolve_test uri_relative
static
Initial value:
= {
"http://boot.ipxe.org/demo/boot.php?vendor=10ec&device=8139",
"initrd.img",
"http://boot.ipxe.org/demo/initrd.img",
}

Relative URI resolution test.

Definition at line 691 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_absolute

struct uri_resolve_test uri_absolute
static
Initial value:
= {
"http://boot.ipxe.org/demo/boot.php",
"ftp://192.168.0.1/boot.ipxe",
"ftp://192.168.0.1/boot.ipxe",
}

Absolute URI resolution test.

Definition at line 698 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_absolute_uri_path

struct uri_resolve_test uri_absolute_uri_path
static
Initial value:
= {
"http://boot.ipxe.org/demo/boot.php#test",
"/demo/vmlinuz",
"http://boot.ipxe.org/demo/vmlinuz",
}

Absolute path URI resolution test.

Definition at line 705 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_query

struct uri_resolve_test uri_query
static
Initial value:
= {
"http://10.253.253.1/test.pl?mac=02-00-69-50-58-45",
"?mac=00-1f-16-bc-fe-2f",
"http://10.253.253.1/test.pl?mac=00-1f-16-bc-fe-2f",
}

Query URI resolution test.

Definition at line 712 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_fragment

struct uri_resolve_test uri_fragment
static
Initial value:
= {
"http://192.168.0.254/test#foo",
"#bar",
"http://192.168.0.254/test#bar",
}

Fragment URI resolution test.

Definition at line 719 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_pxe_absolute

struct uri_pxe_test uri_pxe_absolute
static
Initial value:
= {
{
.sin = {
.sin_family = AF_INET,
.sin_addr = { .s_addr = htonl ( 0xc0a80003 ) },
},
},
"http://not.a.tftp/uri",
{
.scheme = "http",
.host = "not.a.tftp",
.path = "/uri",
},
"http://not.a.tftp/uri",
}
#define htonl(value)
Definition: byteswap.h:133
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63

PXE URI with absolute URI.

Definition at line 726 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_pxe_absolute_path

struct uri_pxe_test uri_pxe_absolute_path
static
Initial value:
= {
{
.sin = {
.sin_family = AF_INET,
.sin_addr = { .s_addr = htonl ( 0xc0a80002 ) },
},
},
"/absolute/path",
{
.scheme = "tftp",
.host = "192.168.0.2",
.path = "//absolute/path",
},
"tftp://192.168.0.2//absolute/path",
}
#define htonl(value)
Definition: byteswap.h:133
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63

PXE URI with absolute path.

Definition at line 744 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_pxe_relative_path

struct uri_pxe_test uri_pxe_relative_path
static
Initial value:
= {
{
.sin = {
.sin_family = AF_INET,
.sin_addr = { .s_addr = htonl ( 0xc0a80003 ) },
},
},
"relative/path",
{
.scheme = "tftp",
.host = "192.168.0.3",
.path = "/relative/path",
},
"tftp://192.168.0.3/relative/path",
}
#define htonl(value)
Definition: byteswap.h:133
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63

PXE URI with relative path.

Definition at line 762 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_pxe_icky

struct uri_pxe_test uri_pxe_icky
static
Initial value:
= {
{
.sin = {
.sin_family = AF_INET,
.sin_addr = { .s_addr = htonl ( 0x0a000006 ) },
},
},
"C:\\tftpboot\\icky#path",
{
.scheme = "tftp",
.host = "10.0.0.6",
.path = "/C:\\tftpboot\\icky#path",
},
"tftp://10.0.0.6/C%3A\\tftpboot\\icky%23path",
}
#define htonl(value)
Definition: byteswap.h:133
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63

PXE URI with path containing special characters.

Definition at line 780 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_pxe_port

struct uri_pxe_test uri_pxe_port
static
Initial value:
= {
{
.sin = {
.sin_family = AF_INET,
.sin_addr = { .s_addr = htonl ( 0xc0a80001 ) },
.sin_port = htons ( 4069 ),
},
},
"/another/path",
{
.scheme = "tftp",
.host = "192.168.0.1",
.port = "4069",
.path = "//another/path",
},
"tftp://192.168.0.1:4069//another/path",
}
#define htonl(value)
Definition: byteswap.h:133
#define htons(value)
Definition: byteswap.h:135
#define AF_INET
IPv4 Internet addresses.
Definition: socket.h:63

PXE URI with custom port.

Definition at line 798 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_churi

struct uri_churi_test uri_churi[]
static
Initial value:
= {
{
"http://boot.ipxe.org/demo/boot.php",
"http://boot.ipxe.org/demo/boot.php",
},
{
"?vendor=10ec&device=8139",
"http://boot.ipxe.org/demo/boot.php?vendor=10ec&device=8139",
},
{
"fedora/fedora.ipxe",
"http://boot.ipxe.org/demo/fedora/fedora.ipxe",
},
{
"vmlinuz",
"http://boot.ipxe.org/demo/fedora/vmlinuz",
},
{
"http://local/boot/initrd.img",
"http://local/boot/initrd.img",
},
{
"modules/8139too.ko",
"http://local/boot/modules/8139too.ko",
},
{
}
}
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

Current working URI test.

Definition at line 818 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_params_list

struct uri_params_test_list uri_params_list[]
static
Initial value:
= {
{
"vendor",
"10ec",
},
{
"device",
"8139",
},
{
"uuid",
"f59fac00-758f-498f-9fe5-87d790045d94",
},
{
}
}
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

Form parameter URI test list.

Definition at line 850 of file uri_test.c.

◆ uri_params

struct uri_params_test uri_params
static
Initial value:
= {
"http://boot.ipxe.org/demo/boot.php##params",
{
.scheme = "http",
.host = "boot.ipxe.org",
.path = "/demo/boot.php",
},
}
static struct uri_params_test_list uri_params_list[]
Form parameter URI test list.
Definition: uri_test.c:850
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

Form parameter URI test.

Definition at line 870 of file uri_test.c.

Referenced by uri_test_exec().

◆ uri_named_params_list

struct uri_params_test_list uri_named_params_list[]
static
Initial value:
= {
{
"mac",
"00:1e:65:80:d3:b6",
},
{
"serial",
"LXTQ20Z1139322762F2000",
},
{
}
}
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

Named form parameter URI test list.

Definition at line 882 of file uri_test.c.

◆ uri_named_params

struct uri_params_test uri_named_params
static
Initial value:
= {
"http://192.168.100.4:3001/register##params=foo",
{
.scheme = "http",
.host = "192.168.100.4",
.port = "3001",
.path = "/register",
},
"foo",
}
static struct uri_params_test_list uri_named_params_list[]
Named form parameter URI test list.
Definition: uri_test.c:882

Named form parameter URI test.

Definition at line 898 of file uri_test.c.

Referenced by uri_test_exec().

◆ __self_test

struct self_test uri_test __self_test
Initial value:
= {
.name = "uri",
.exec = uri_test_exec,
}
static void uri_test_exec(void)
Perform URI self-test.
Definition: uri_test.c:914

URI self-test.

Definition at line 968 of file uri_test.c.