1 /** 2 * Utilities for the quality of service module mod_qos. 3 * 4 * See http://mod-qos.sourceforge.net/ for further 5 * details. 6 * 7 * Copyright (C) 2020 Pascal Buchbinder 8 * 9 * Licensed to the Apache Software Foundation (ASF) under one or more 10 * contributor license agreements. See the NOTICE file distributed with 11 * this work for additional information regarding copyright ownership. 12 * The ASF licenses this file to You under the Apache License, Version 2.0 13 * (the "License"); you may not use this file except in compliance with 14 * the License. You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 * 24 */ 25 26 #ifndef QS_UTIL_H 27 #define QS_UTIL_H 28 29 /* ---------------------------------- 30 * version info 31 * ---------------------------------- */ 32 static const char man_version[] = "11.66"; 33 static const char man_date[] = "May 2020"; 34 35 /* ---------------------------------- 36 * definitions 37 * ---------------------------------- */ 38 /* huge (128kb) buffer supporting very long lines (twice as 39 much as Apache's rotatelogs uses */ 40 #define MAX_LINE_BUFFER 131072 41 /* smaller buffer, e.g. for qslog */ 42 #define MAX_LINE 32768 43 #define QS_HUGE_STR 2048 44 #define CR 13 45 #define LF 10 46 47 /* ---------------------------------- 48 * functions 49 * ---------------------------------- */ 50 char *qs_CMD(const char *cmd); 51 void qs_man_print(int man, const char *fmt, ...); 52 void qs_man_println(int man, const char *fmt, ...); 53 54 /* io */ 55 int qs_getLine(char *s, int n); 56 int qs_getLinef(char *s, int n, FILE *f); 57 58 /* time */ 59 void qs_time(time_t *tme); 60 void qs_set2OfflineMode(); 61 void qs_setTime(time_t tme); 62 63 /* synchronisation */ 64 void qs_csInitLock(); 65 void qs_csLock(); 66 void qs_csUnLock(); 67 68 /* log */ 69 void qs_deleteOldFiles(const char *file_name, int generations); 70 71 /* user */ 72 void qs_setuid(const char *username, const char *cmd); 73 74 #endif 75