Ada 2.9.2
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
ada_c.c
Go to the documentation of this file.
1#include "ada_c.h"
2
3#include <stdbool.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7
8int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
12 ada_url out = ada_parse((char*)data, size);
13 bool is_valid = ada_is_valid(out);
14
15 if (is_valid) {
16 ada_set_href(out, (char*)data, size);
17 ada_set_host(out, (char*)data, size);
18 ada_set_hostname(out, (char*)data, size);
19 ada_set_protocol(out, (char*)data, size);
20 ada_set_username(out, (char*)data, size);
21 ada_set_password(out, (char*)data, size);
22 ada_set_port(out, (char*)data, size);
23 ada_set_pathname(out, (char*)data, size);
24 ada_set_search(out, (char*)data, size);
25 ada_set_hash(out, (char*)data, size);
26
27 ada_get_hash(out);
28 ada_get_host(out);
31 ada_get_href(out);
32 ada_owned_string out_get_origin = ada_get_origin(out);
37 ada_get_port(out);
38 ada_get_search(out);
40
46 ada_has_port(out);
48 ada_has_hash(out);
49 ada_has_search(out);
50
52
53 ada_clear_port(out);
54 ada_clear_hash(out);
56
57 ada_free_owned_string(out_get_origin);
58 }
59
60 bool can_parse_result = ada_can_parse((char*)data, size);
61
62 ada_free(out);
63
64 return 0;
65}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Definition ada_c.c:8
Includes the C definitions for Ada. This is a C file, not C++.
ada_string ada_get_hash(ada_url result)
Definition ada_c.cpp:166
bool ada_set_port(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:288
void ada_clear_search(ada_url result)
Definition ada_c.cpp:359
bool ada_set_host(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:244
bool ada_has_password(ada_url result)
Definition ada_c.cpp:414
ada_string ada_get_pathname(ada_url result)
Definition ada_c.cpp:193
const ada_url_components * ada_get_components(ada_url result)
Definition ada_c.cpp:439
bool ada_has_empty_hostname(ada_url result)
Definition ada_c.cpp:374
bool ada_has_non_empty_password(ada_url result)
Definition ada_c.cpp:398
bool ada_set_password(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:279
ada_string ada_get_hostname(ada_url result)
Definition ada_c.cpp:184
uint8_t ada_get_host_type(ada_url result)
Definition ada_c.cpp:220
ada_string ada_get_password(ada_url result)
Definition ada_c.cpp:148
bool ada_set_hostname(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:252
ada_string ada_get_port(ada_url result)
Definition ada_c.cpp:157
bool ada_set_pathname(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:296
ada_string ada_get_host(ada_url result)
Definition ada_c.cpp:175
ada_url ada_parse(const char *input, size_t length)
Definition ada_c.cpp:67
bool ada_has_port(ada_url result)
Definition ada_c.cpp:406
void ada_clear_hash(ada_url result)
Definition ada_c.cpp:346
void ada_free_owned_string(ada_owned_string owned)
Definition ada_c.cpp:126
bool ada_set_href(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:236
void ada_free(ada_url result)
Definition ada_c.cpp:95
void * ada_url
Definition ada_c.h:39
ada_owned_string ada_get_origin(ada_url result)
Definition ada_c.cpp:111
ada_string ada_get_protocol(ada_url result)
Definition ada_c.cpp:211
bool ada_set_username(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:270
ada_string ada_get_username(ada_url result)
Definition ada_c.cpp:139
uint8_t ada_get_scheme_type(ada_url result)
Definition ada_c.cpp:228
void ada_clear_port(ada_url result)
Definition ada_c.cpp:333
bool ada_is_valid(ada_url result)
Definition ada_c.cpp:105
void ada_set_search(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:312
ada_string ada_get_href(ada_url result)
Definition ada_c.cpp:130
bool ada_set_protocol(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:261
bool ada_has_hash(ada_url result)
Definition ada_c.cpp:422
bool ada_has_hostname(ada_url result)
Definition ada_c.cpp:382
bool ada_has_credentials(ada_url result)
Definition ada_c.cpp:366
bool ada_can_parse(const char *input, size_t length)
Definition ada_c.cpp:85
ada_string ada_get_search(ada_url result)
Definition ada_c.cpp:202
bool ada_has_non_empty_username(ada_url result)
Definition ada_c.cpp:390
bool ada_has_search(ada_url result)
Definition ada_c.cpp:430
void ada_set_hash(ada_url result, const char *input, size_t length)
Definition ada_c.cpp:326