diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-17 03:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-17 03:51:28 +0000 |
commit | 2b07c041cb218eca6e548bac9c4347f8a90c474c (patch) | |
tree | 679142f3916fa927903c6f245896f5c0325a3254 /tools/src/qs_util.h | |
parent | Initial commit. (diff) | |
download | libapache2-mod-qos-upstream/11.74.tar.xz libapache2-mod-qos-upstream/11.74.zip |
Adding upstream version 11.74.upstream/11.74upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tools/src/qs_util.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tools/src/qs_util.h b/tools/src/qs_util.h new file mode 100644 index 0000000..fa0bc1c --- /dev/null +++ b/tools/src/qs_util.h @@ -0,0 +1,98 @@ +/** + * Utilities for the quality of service module mod_qos. + * + * See http://mod-qos.sourceforge.net/ for further + * details. + * + * Copyright (C) 2023 Pascal Buchbinder + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef QS_UTIL_H +#define QS_UTIL_H + +/* ---------------------------------- + * version info + * ---------------------------------- */ +static const char man_version[] = "11.74"; +static const char man_date[] = "May 2023"; + +/* ---------------------------------- + * definitions + * ---------------------------------- */ +/* huge (128kb) buffer supporting very long lines (twice as + much as Apache's rotatelogs uses */ +#define MAX_LINE_BUFFER 131072 +/* smaller buffer, e.g. for qslog */ +#define MAX_LINE 32768 +#define QS_HUGE_STR 2048 +#define CR 13 +#define LF 10 + +/* ---------------------------------- + * functions + * ---------------------------------- */ +char *qs_CMD(const char *cmd); +void qs_man_print(int man, const char *fmt, ...); +void qs_man_println(int man, const char *fmt, ...); + +/* io */ +int qs_getLine(char *s, int n); +int qs_getLinef(char *s, int n, FILE *f); + +/* time */ +void qs_time(time_t *tme); +void qs_set2OfflineMode(); +void qs_setTime(time_t tme); + +/* synchronisation */ +void qs_csInitLock(); +void qs_csLock(); +void qs_csUnLock(); + +/* log */ +void qs_deleteOldFiles(const char *file_name, int generations); + +/* user */ +void qs_setuid(const char *username, const char *cmd); + +/* pcre */ +#define QS_MAX_REG_MATCH 10 + +typedef struct { + int rm_so; + int rm_eo; +} qs_regmatch_t; + +typedef struct { + void *re_pcre; + int re_nsub; + int state; +} qs_regex_t; + +int qs_pregfree(void *p); + +void qs_regfree(qs_regex_t *preg); + +int qs_regcomp(qs_regex_t *preg, const char *regex, int cflags); + +int qs_regexec_len(const qs_regex_t *preg, const char *buff, + unsigned int len, unsigned int nmatch, + qs_regmatch_t *pmatch, int eflags); + +#endif |