| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 2020 Hannes von Haugwitz |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of the |
| 9 | * License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #include "url.h"cxx . . $ `<file>/include/url.h`/ |
| 22 | |
| 23 | #include <string.h> |
| 24 | |
| 25 | struct url_typecxx . . $ url_type# { |
| 26 | URL_TYPEcxx . . $ URL_TYPE# typecxx . . $ url_type#type.; |
| 27 | const char *stringcxx . . $ url_type#string.; |
| 28 | }; |
| 29 | |
| 30 | static struct url_typecxx . . $ url_type# url_type_arraycxx . . $ url_type_array.[] = { |
| 31 | { url_filecxx . . $ url_file., "file" }, |
| 32 | { url_stdoutcxx . . $ url_stdout., "stdout" }, |
| 33 | { url_stdincxx . . $ url_stdin., "stdin" }, |
| 34 | { url_stderrcxx . . $ url_stderr., "stderr" }, |
| 35 | { url_fdcxx . . $ url_fd., "fd" }, |
| 36 | { url_ftpcxx . . $ url_ftp., "ftp" }, |
| 37 | { url_httpcxx . . $ url_http., "http" }, |
| 38 | { url_httpscxx . . $ url_https., "https" }, |
| 39 | { url_syslogcxx . . $ url_syslog., "syslog" }, |
| 40 | }; |
| 41 | |
| 42 | int num_url_typescxx . . $ num_url_types. = sizeof(url_type_arraycxx . . $ url_type_array.)/sizeof(struct url_typecxx . . $ url_type#); |
| 43 | |
| 44 | URL_TYPEcxx . . $ URL_TYPE# get_url_typecxx . . $ get_url_type(f5c03b637e4e739e).(char * str) { |
| 45 | |
| 46 | for (int i = 0; i < num_url_typescxx . . $ num_url_types.; ++i) { |
| 47 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, url_type_arraycxx . . $ url_type_array.[i].stringcxx . . $ url_type#string.) == 0) { |
| 48 | return url_type_arraycxx . . $ url_type_array.[i].typecxx . . $ url_type#type.; |
| 49 | } |
| 50 | } |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | const char* get_url_type_stringcxx . . $ get_url_type_string(6e06a7e3ceb1c24f).(URL_TYPEcxx . . $ URL_TYPE# type) { |
| 55 | return url_type_arraycxx . . $ url_type_array.[type-1].stringcxx . . $ url_type#string.; |
| 56 | } |