Version 0.53
- code cleanup (mostly doxygen tags) - added doxygen file
This commit is contained in:
parent
7f0b2fd78f
commit
861d41be08
|
@ -1,3 +1,7 @@
|
|||
* Tue 19 Apr 2005 Olaf Rempel <razzor@kopf-tisch.de> 0.53
|
||||
- code cleanup (mostly doxygen tags)
|
||||
- added doxygen file
|
||||
|
||||
* Thu 31 Mar 2005 Olaf Rempel <razzor@kopf-tisch.de> 0.52
|
||||
- games added: avp2, bfv, igi2, jk2, jk3, rtcw, ut2k3, ut2k4
|
||||
- sendqueue removed (no need to do ratelimiting)
|
||||
|
|
|
@ -2,4 +2,4 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
|
|||
|
||||
SUBDIRS = src plugins tools
|
||||
|
||||
EXTRA_DIST = TODO autogen.sh hlswmaster.conf
|
||||
EXTRA_DIST = TODO autogen.sh hlswmaster.conf contrib
|
||||
|
|
|
@ -174,7 +174,7 @@ sysconfdir = @sysconfdir@
|
|||
target_alias = @target_alias@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
SUBDIRS = src plugins tools
|
||||
EXTRA_DIST = TODO autogen.sh hlswmaster.conf
|
||||
EXTRA_DIST = TODO autogen.sh hlswmaster.conf contrib
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59 for hlswmaster 0.52.
|
||||
# Generated by GNU Autoconf 2.59 for hlswmaster 0.53.
|
||||
#
|
||||
# Report bugs to <Olaf Rempel <razzor@kopf-tisch.de>>.
|
||||
#
|
||||
|
@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='hlswmaster'
|
||||
PACKAGE_TARNAME='hlswmaster'
|
||||
PACKAGE_VERSION='0.52'
|
||||
PACKAGE_STRING='hlswmaster 0.52'
|
||||
PACKAGE_VERSION='0.53'
|
||||
PACKAGE_STRING='hlswmaster 0.53'
|
||||
PACKAGE_BUGREPORT='Olaf Rempel <razzor@kopf-tisch.de>'
|
||||
|
||||
# Factoring default headers for most tests.
|
||||
|
@ -953,7 +953,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures hlswmaster 0.52 to adapt to many kinds of systems.
|
||||
\`configure' configures hlswmaster 0.53 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1019,7 +1019,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of hlswmaster 0.52:";;
|
||||
short | recursive ) echo "Configuration of hlswmaster 0.53:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ fi
|
|||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
hlswmaster configure 0.52
|
||||
hlswmaster configure 0.53
|
||||
generated by GNU Autoconf 2.59
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
@ -1174,7 +1174,7 @@ cat >&5 <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by hlswmaster $as_me 0.52, which was
|
||||
It was created by hlswmaster $as_me 0.53, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -1818,7 +1818,7 @@ fi
|
|||
|
||||
# Define the identity of the package.
|
||||
PACKAGE=hlswmaster
|
||||
VERSION=0.52
|
||||
VERSION=0.53
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
@ -21419,7 +21419,7 @@ _ASBOX
|
|||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by hlswmaster $as_me 0.52, which was
|
||||
This file was extended by hlswmaster $as_me 0.53, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -21482,7 +21482,7 @@ _ACEOF
|
|||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
hlswmaster config.status 0.52
|
||||
hlswmaster config.status 0.53
|
||||
configured by $0, generated by GNU Autoconf 2.59,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
dnl projekname, version, bugsto
|
||||
AC_INIT(hlswmaster, 0.52, [Olaf Rempel <razzor@kopf-tisch.de>])
|
||||
AC_INIT(hlswmaster, 0.53, [Olaf Rempel <razzor@kopf-tisch.de>])
|
||||
|
||||
dnl same for automake
|
||||
AM_INIT_AUTOMAKE(hlswmaster, 0.52)
|
||||
AM_INIT_AUTOMAKE(hlswmaster, 0.53)
|
||||
|
||||
dnl do not rebuild configure
|
||||
AM_MAINTAINER_MODE
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
# Doxyfile 1.3.9.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = hlswmaster
|
||||
PROJECT_NUMBER = 0.53
|
||||
OUTPUT_DIRECTORY = ../doc
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = NO
|
||||
REPEAT_BRIEF = NO
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../src \
|
||||
../include \
|
||||
../plugins/skel.c
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
|
@ -1,22 +1,22 @@
|
|||
[global]
|
||||
# broadcast scan source IP & PORT (udp)
|
||||
#scan_ip 0.0.0.0
|
||||
#scan_port 7130
|
||||
scan_ip 0.0.0.0
|
||||
scan_port 7130
|
||||
|
||||
# broadcast scan every X seconds
|
||||
#scan_interval 30
|
||||
scan_interval 30
|
||||
|
||||
# serverlist rebuild every X seconds
|
||||
#serverlist_interval 5
|
||||
serverlist_interval 5
|
||||
|
||||
# server timeout after X seconds
|
||||
#serverlist_timeout 30
|
||||
serverlist_timeout 30
|
||||
|
||||
# plugin data timeout every X seconds
|
||||
#plugin_timeout 30
|
||||
plugin_timeout 30
|
||||
|
||||
# master answers with this source IP
|
||||
#master_ip 0.0.0.0
|
||||
master_ip 0.0.0.0
|
||||
|
||||
# load these plugins
|
||||
plugin plugins/.libs/hlswproxy.so
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
#define _LIST_H
|
||||
|
||||
/*
|
||||
** stolen from linux kernel (2.6.11)
|
||||
** linux/include/linux/stddef.h (offsetoff)
|
||||
** linux/include/linux/kernel.h (container_of)
|
||||
** linux/include/linux/list.h (*list*)
|
||||
** linux/include/linux/netfilter_ipv4/listhelp.h (LIST_FIND)
|
||||
**
|
||||
** modified by Olaf Rempel
|
||||
*/
|
||||
* stolen from linux kernel (2.6.11)
|
||||
* linux/include/linux/stddef.h (offsetoff)
|
||||
* linux/include/linux/kernel.h (container_of)
|
||||
* linux/include/linux/list.h (*list*)
|
||||
* linux/include/linux/netfilter_ipv4/listhelp.h (LIST_FIND)
|
||||
*
|
||||
* modified by Olaf Rempel
|
||||
*/
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
|
@ -45,7 +45,7 @@ static inline void __list_add(struct list_head *new,
|
|||
prev->next = new;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_add - add a new entry
|
||||
* @new: new entry to be added
|
||||
* @head: list head to add it after
|
||||
|
@ -58,7 +58,7 @@ static inline void list_add(struct list_head *new, struct list_head *head)
|
|||
__list_add(new, head, head->next);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_add_tail - add a new entry
|
||||
* @new: new entry to be added
|
||||
* @head: list head to add it before
|
||||
|
@ -71,7 +71,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
|||
__list_add(new, head->prev, head);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Delete a list entry by making the prev/next entries
|
||||
* point to each other.
|
||||
*
|
||||
|
@ -84,7 +84,7 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
|
|||
prev->next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_del - deletes entry from list.
|
||||
* @entry: the element to delete from the list.
|
||||
* Note: list_empty on entry does not return true after this, the entry is
|
||||
|
@ -97,9 +97,9 @@ static inline void list_del(struct list_head *entry)
|
|||
entry->prev = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_del_init - deletes entry from list and reinitialize it.
|
||||
* @entry: the element to delete from the list.
|
||||
* entry: the element to delete from the list.
|
||||
*/
|
||||
static inline void list_del_init(struct list_head *entry)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ static inline void list_del_init(struct list_head *entry)
|
|||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_move - delete from one list and add as another's head
|
||||
* @list: the entry to move
|
||||
* @head: the head that will precede our entry
|
||||
|
@ -118,7 +118,7 @@ static inline void list_move(struct list_head *list, struct list_head *head)
|
|||
list_add(list, head);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_move_tail - delete from one list and add as another's tail
|
||||
* @list: the entry to move
|
||||
* @head: the head that will follow our entry
|
||||
|
@ -130,7 +130,7 @@ static inline void list_move_tail(struct list_head *list,
|
|||
list_add_tail(list, head);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_empty - tests whether a list is empty
|
||||
* @head: the list to test.
|
||||
*/
|
||||
|
@ -153,7 +153,7 @@ static inline void __list_splice(struct list_head *list,
|
|||
at->prev = last;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_splice - join two lists
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
|
@ -164,7 +164,7 @@ static inline void list_splice(struct list_head *list, struct list_head *head)
|
|||
__list_splice(list, head);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_splice_init - join two lists and reinitialise the emptied list.
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
|
@ -180,7 +180,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_entry - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
* @type: the type of the struct this is embedded in.
|
||||
|
@ -189,7 +189,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each - iterate over a list
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
|
@ -197,7 +197,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each_prev - iterate over a list backwards
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
|
@ -205,7 +205,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
#define list_for_each_prev(pos, head) \
|
||||
for (pos = (head)->prev; pos != (head); pos = pos->prev)
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each_safe - iterate over a list safe against removal of list entry
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @n: another &struct list_head to use as temporary storage
|
||||
|
@ -215,7 +215,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||
pos = n, n = pos->next)
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each_entry - iterate over list of given type
|
||||
* @pos: the type * to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
|
@ -226,7 +226,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each_entry_reverse - iterate backwards over list of given type.
|
||||
* @pos: the type * to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
|
@ -237,7 +237,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.prev, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
/*
|
||||
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||
* @pos: the type * to use as a loop counter.
|
||||
* @n: another type * to use as temporary storage
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* scan()
|
||||
* wird periodisch aufgerufen um server querys loszuschicken.
|
||||
*
|
||||
* @return int false bei fehler
|
||||
* @return false bei fehler
|
||||
*/
|
||||
static int scan(void) {
|
||||
char myscan[] = "hallo"
|
||||
|
@ -56,8 +56,8 @@ static int scan(void) {
|
|||
* Wenn das Paket fuer diesen Plugin einen Sinn ergibt,
|
||||
* wird true zurueckgegeben.
|
||||
*
|
||||
* @param struct net_pkt *pkt - Pointer auf das empfangene Paket
|
||||
* @return int true wenn das Plugin das Paket parsen konnte
|
||||
* @param *pkt empfangenes Paket
|
||||
* @return true wenn das Plugin das Paket parsen konnte
|
||||
*/
|
||||
static int parse(struct net_pkt *pkt) {
|
||||
/* checken ob das paket vom richtigen port kommt: */
|
||||
|
@ -110,7 +110,7 @@ static int parse(struct net_pkt *pkt) {
|
|||
* im Configfile uebergeben, die in der Configsection des Plugins
|
||||
* stehen ([Section] == Pluginname)
|
||||
*
|
||||
* @param struct conf_section *section
|
||||
* @param *section config section
|
||||
* @return false bei fehler
|
||||
*/
|
||||
static int init(struct conf_section *section) {
|
||||
|
@ -136,7 +136,7 @@ static int fini() {
|
|||
* wird periodisch aufgerufen um Plugin interne Daten aufzufrischen
|
||||
* als Parameter wird der plugin_timeout Wert uebergeben
|
||||
*
|
||||
* @param int timeout
|
||||
* @param timeout timeout in sekunden
|
||||
* @return false bei fehler
|
||||
*/
|
||||
static int gc(int timeout) {
|
||||
|
|
87
src/client.c
87
src/client.c
|
@ -42,61 +42,64 @@ struct client_pkt {
|
|||
unsigned char buf[0];
|
||||
};
|
||||
|
||||
/* real und prepare list. enthalten die client-antworten */
|
||||
/** working list (wird zu den clients gesendet) */
|
||||
static LIST_HEAD(client_pkt_list);
|
||||
|
||||
/** prepare list (wird im hintergrund zusammengebaut) */
|
||||
static LIST_HEAD(client_pkt_prepare);
|
||||
|
||||
/* sichert die real list ab */
|
||||
static pthread_mutex_t pkt_list_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
/** sichert die work list ab */
|
||||
static pthread_mutex_t client_pkt_list_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/**
|
||||
* pkt_not_full()
|
||||
* LIST_FIND helper
|
||||
/**
|
||||
* client_pkt_not_full()
|
||||
* prueft ob ein client-paket komplett belegt ist
|
||||
*
|
||||
* @param struct client_pkt *a
|
||||
* @param void *b
|
||||
* @param *cpkt pointer auf paket das getestet wird
|
||||
* @param *unused
|
||||
* @return true wenn das paket noch nicht voll ist
|
||||
*/
|
||||
static inline int cpkt_not_full(const struct client_pkt *a, void *b) {
|
||||
return (a->size <= (MAX_PKT_LEN - HLSW_ENTRY_LEN));
|
||||
static inline int client_pkt_not_full(const struct client_pkt *cpkt, void *unused) {
|
||||
return (cpkt->size > (MAX_PKT_LEN - HLSW_ENTRY_LEN));
|
||||
}
|
||||
|
||||
/**
|
||||
* client_pkt_add_real()
|
||||
* erzeugt eine neues client_pkt und fuegt es einer liste hinzu
|
||||
* gibt einen pointer auf das neue client_pkt zurueck
|
||||
*
|
||||
* @param struct list_head *list
|
||||
* @return struct client_pkt * or NULL on error
|
||||
* @param *list liste die das neue paket aufnimmt
|
||||
* @return pointer auf ein neues paket oder NULL bei fehler
|
||||
*/
|
||||
static struct client_pkt * client_pkt_add_real(struct list_head *list) {
|
||||
struct client_pkt *pkt;
|
||||
struct client_pkt *cpkt;
|
||||
|
||||
pkt = malloc(sizeof(struct client_pkt) + MAX_PKT_LEN);
|
||||
if (pkt) {
|
||||
INIT_LIST_HEAD(&pkt->list);
|
||||
cpkt = malloc(sizeof(struct client_pkt) + MAX_PKT_LEN);
|
||||
if (cpkt) {
|
||||
INIT_LIST_HEAD(&cpkt->list);
|
||||
|
||||
/* kopier den hlsw header in das client paket */
|
||||
memcpy(pkt->buf, HLSW_HEADER, HLSW_HEADER_LEN);
|
||||
pkt->size = HLSW_HEADER_LEN;
|
||||
memcpy(cpkt->buf, HLSW_HEADER, HLSW_HEADER_LEN);
|
||||
cpkt->size = HLSW_HEADER_LEN;
|
||||
|
||||
list_add_tail(&pkt->list, list);
|
||||
/* am anfang eingliedern! */
|
||||
list_add(&cpkt->list, list);
|
||||
}
|
||||
return pkt;
|
||||
return cpkt;
|
||||
}
|
||||
|
||||
/**
|
||||
* client_pkt_add()
|
||||
* fuegt dem freien client_pkt der prepare-liste ein Spiel hinzu
|
||||
* wenn kein platz vorhanden ist, wird ein neues paket erzeugt
|
||||
* fuegt der client_pkt liste einen server hinzu, wenn kein platz
|
||||
* im aktuellen paket vorhanden ist, wird ein neues paket allokiert
|
||||
*
|
||||
* @param struct game_server *server
|
||||
* @return false bei fehler (malloc)
|
||||
* @param *server pointer den server
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int client_pkt_add(struct game_server *server) {
|
||||
struct client_pkt *cpkt;
|
||||
|
||||
cpkt = LIST_FIND(&client_pkt_prepare, cpkt_not_full, struct client_pkt *, NULL);
|
||||
/* sucht ein freies paket, oder erzeugt eins */
|
||||
cpkt = LIST_FIND(&client_pkt_prepare, client_pkt_not_full, struct client_pkt *, NULL);
|
||||
if (!cpkt && !(cpkt = client_pkt_add_real(&client_pkt_prepare)))
|
||||
return 0;
|
||||
|
||||
|
@ -109,21 +112,21 @@ int client_pkt_add(struct game_server *server) {
|
|||
|
||||
/**
|
||||
* client_pkt_commit()
|
||||
* die prepare liste wird die echte liste und
|
||||
* alle pakete der alten echten liste werden entfernt
|
||||
* die prepare liste und die work liste werden ausgetauscht
|
||||
* alle pakete der alten work liste werden entfernt
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
int client_pkt_commit() {
|
||||
struct list_head old_list, *pkt, *tmp;
|
||||
struct list_head old_list, *cpkt, *tmp;
|
||||
|
||||
/* wenn die liste leer ist, nur HLSW-header verschicken */
|
||||
if (list_empty(&client_pkt_prepare))
|
||||
client_pkt_add_real(&client_pkt_prepare);
|
||||
|
||||
pthread_mutex_lock(&pkt_list_lock);
|
||||
pthread_mutex_lock(&client_pkt_list_lock);
|
||||
|
||||
/* old_list wird head der real list */
|
||||
/* old_list wird head der work list */
|
||||
list_add(&old_list, &client_pkt_list);
|
||||
list_del(&client_pkt_list);
|
||||
|
||||
|
@ -131,22 +134,22 @@ int client_pkt_commit() {
|
|||
list_add(&client_pkt_list, &client_pkt_prepare);
|
||||
list_del_init(&client_pkt_prepare);
|
||||
|
||||
pthread_mutex_unlock(&pkt_list_lock);
|
||||
pthread_mutex_unlock(&client_pkt_list_lock);
|
||||
|
||||
/* alle alten pakete entfernen */
|
||||
list_for_each_safe(pkt, tmp, &old_list) {
|
||||
list_del(pkt);
|
||||
free(pkt);
|
||||
list_for_each_safe(cpkt, tmp, &old_list) {
|
||||
list_del(cpkt);
|
||||
free(cpkt);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* client_handler()
|
||||
* empfaengt und beantwortet die HLSW Anfragen
|
||||
* empfaengt und beantwortet die HLSW anfragen der clients
|
||||
*/
|
||||
void client_handler(void) {
|
||||
struct client_pkt *pkt;
|
||||
struct client_pkt *cpkt;
|
||||
struct sockaddr_in dst;
|
||||
int sock, i;
|
||||
unsigned char buf[32], *ip;
|
||||
|
@ -177,12 +180,12 @@ void client_handler(void) {
|
|||
if (memcmp(buf, HLSW_HEADER, HLSW_HEADER_LEN))
|
||||
continue;
|
||||
|
||||
pthread_mutex_lock(&pkt_list_lock);
|
||||
pthread_mutex_lock(&client_pkt_list_lock);
|
||||
|
||||
/* pakete aus der real list senden */
|
||||
list_for_each_entry(pkt, &client_pkt_list, list)
|
||||
sendto(sock, pkt->buf, pkt->size, 0, (struct sockaddr *)&dst, sizeof(dst));
|
||||
/* pakete aus der work list senden */
|
||||
list_for_each_entry(cpkt, &client_pkt_list, list)
|
||||
sendto(sock, cpkt->buf, cpkt->size, 0, (struct sockaddr *)&dst, sizeof(dst));
|
||||
|
||||
pthread_mutex_unlock(&pkt_list_lock);
|
||||
pthread_mutex_unlock(&client_pkt_list_lock);
|
||||
}
|
||||
}
|
||||
|
|
62
src/config.c
62
src/config.c
|
@ -28,14 +28,17 @@
|
|||
|
||||
//#define DEBUG 1
|
||||
|
||||
/* liste config optionen */
|
||||
/** liste der config-sections */
|
||||
static LIST_HEAD(config_list);
|
||||
|
||||
/**
|
||||
* config_add_section()
|
||||
* fuegt der config liste ein section hinzu
|
||||
* @param char *name
|
||||
* @return struct conf_section *
|
||||
* allokiert eine neue section und fuegt sie der config liste hinzu
|
||||
*
|
||||
* @param *name name der section
|
||||
* @return pointer auf die section, oder NULL bei fehler
|
||||
*
|
||||
* @todo sectionname ist nicht eindeutig
|
||||
*/
|
||||
static struct conf_section * config_add_section(char *name) {
|
||||
struct conf_section *section;
|
||||
|
@ -56,10 +59,11 @@ static struct conf_section * config_add_section(char *name) {
|
|||
|
||||
/**
|
||||
* config_add_tupel()
|
||||
* fuegt einer config section ein werte tupel hinzu
|
||||
* @param struct conf_section *
|
||||
* @param char *option
|
||||
* @param char *parameter
|
||||
* fuegt einer section ein config tupel hinzu
|
||||
*
|
||||
* @param *section config section
|
||||
* @param *option name der option
|
||||
* @param *parameter wert der option
|
||||
* @return false bei fehler
|
||||
*/
|
||||
static int config_add_tupel(struct conf_section *section, char *option, char *parameter) {
|
||||
|
@ -104,7 +108,7 @@ static void config_free() {
|
|||
* config_parse()
|
||||
* parsed die configfile
|
||||
*
|
||||
* @param char *config
|
||||
* @param *config filename des configfiles
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int config_parse(char *config) {
|
||||
|
@ -126,9 +130,12 @@ int config_parse(char *config) {
|
|||
|
||||
while (fgets(row, 1024, fz)) {
|
||||
i++;
|
||||
|
||||
/* kommentar oder leere zeile */
|
||||
if (row[0] == '#' || row[0] <= ' ') {
|
||||
continue;
|
||||
|
||||
/* neue section */
|
||||
} else if (row[0] == '[') {
|
||||
tok = strtok(row +1, " ]\n");
|
||||
section = config_add_section(tok);
|
||||
|
@ -139,12 +146,14 @@ int config_parse(char *config) {
|
|||
}
|
||||
continue;
|
||||
|
||||
/* option, aber es gab noch keine section */
|
||||
} else if (!section) {
|
||||
log_print("config_parse(): missing section in row %d", i);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* option */
|
||||
if ((tok = strtok(row, " \n")) && (tok2 = strtok(NULL, " \n")))
|
||||
if (!config_add_tupel(section, tok, tok2))
|
||||
log_print("config_parse(): invalid row %d", i);
|
||||
|
@ -153,6 +162,7 @@ int config_parse(char *config) {
|
|||
fclose(fz);
|
||||
free(row);
|
||||
|
||||
/* beim beenden die liste wieder freigeben */
|
||||
if (atexit(config_free) != 0) {
|
||||
log_print("config_parse(): atexit()");
|
||||
return 0;
|
||||
|
@ -174,12 +184,10 @@ int config_parse(char *config) {
|
|||
|
||||
/**
|
||||
* config_get_section()
|
||||
* gibt einen pointer auf die erste section mit dem
|
||||
* angegebenen namen zurueck
|
||||
* wenn nicht vorhanden NULL
|
||||
* gibt eine benannte section zurueck
|
||||
*
|
||||
* @param char *name
|
||||
* @return struct conf_section *
|
||||
* @param *name name der section
|
||||
* @return pointer auf die section, oder NULL bei fehler
|
||||
*/
|
||||
struct conf_section * config_get_section(char *name) {
|
||||
struct conf_section *section;
|
||||
|
@ -196,9 +204,9 @@ struct conf_section * config_get_section(char *name) {
|
|||
* gibt den parameter der ersten passenden option
|
||||
* in einer section zurueck
|
||||
*
|
||||
* @param struct conf_section *section
|
||||
* @param char *option
|
||||
* @return char *
|
||||
* @param *section pointer auf die section
|
||||
* @param *option option name
|
||||
* @return pointer auf den parameter string oder NULL bei fehler
|
||||
*/
|
||||
char * config_get_parameter(struct conf_section *section, char *option) {
|
||||
struct conf_tupel *tupel;
|
||||
|
@ -213,11 +221,11 @@ char * config_get_parameter(struct conf_section *section, char *option) {
|
|||
/**
|
||||
* config_get_string()
|
||||
* gibt den parameter des section/option tupels zurueck
|
||||
* wenn nicht vorhanden, wird def zurueckgegeben
|
||||
* @param char *section
|
||||
* @param chat *option
|
||||
* @param char *def
|
||||
* @return char *
|
||||
*
|
||||
* @param *section name der section
|
||||
* @param *option name der option
|
||||
* @param *def default string
|
||||
* @return parameter string oder default string bei fehler
|
||||
*/
|
||||
char * config_get_string(char *section, char *option, char *def) {
|
||||
struct conf_section *tmp;
|
||||
|
@ -233,11 +241,11 @@ char * config_get_string(char *section, char *option, char *def) {
|
|||
/**
|
||||
* config_get_int()
|
||||
* gibt den parameter des section/option tupels zurueck
|
||||
* wenn nicht vorhanden, wird def zurueckgegeben
|
||||
* @param char *section
|
||||
* @param char *option
|
||||
* @param int def
|
||||
* @return int
|
||||
*
|
||||
* @param *section name der section
|
||||
* @param *option name der option
|
||||
* @param *def default wert
|
||||
* @return parameter wert oder default wert bei fehler
|
||||
*/
|
||||
int config_get_int(char *section, char *option, int def) {
|
||||
char *ret;
|
||||
|
|
|
@ -33,7 +33,9 @@ static FILE *log_fd = NULL;
|
|||
* schreibt eine Zeile ins Logfile oder auf stderr
|
||||
* wenn errno gesetzt ist, wird der error-string mit ausgegeben
|
||||
*
|
||||
* @param variable parameterlist
|
||||
* @param fmt variable argumentenliste (syntax wie bei printf)
|
||||
*
|
||||
* @todo code vereinfachen?
|
||||
*/
|
||||
void log_print(const char *fmt, ...) {
|
||||
va_list az;
|
||||
|
@ -43,6 +45,7 @@ void log_print(const char *fmt, ...) {
|
|||
vsprintf(buffer, fmt, az);
|
||||
va_end(az);
|
||||
|
||||
/* ins logfile loggen */
|
||||
if (log_fd) {
|
||||
time_t tzgr;
|
||||
char tbuf[64];
|
||||
|
@ -54,6 +57,10 @@ void log_print(const char *fmt, ...) {
|
|||
} else {
|
||||
fprintf(log_fd, "%s %s\n", tbuf, buffer);
|
||||
}
|
||||
|
||||
fflush(log_fd);
|
||||
|
||||
/* nach stderr loggen */
|
||||
} else {
|
||||
if (errno) {
|
||||
fprintf(stderr, "%s: %s\n", buffer, strerror(errno));
|
||||
|
@ -62,7 +69,6 @@ void log_print(const char *fmt, ...) {
|
|||
}
|
||||
}
|
||||
errno = 0;
|
||||
fflush(log_fd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,18 +81,23 @@ static void log_close() {
|
|||
|
||||
/**
|
||||
* log_init()
|
||||
* oeffnet das logfile
|
||||
* wenn der prozess sich beendet, wird das logfile auch wieder geschlossen
|
||||
* initialisiert das logging
|
||||
*
|
||||
* @param logfile filename des logfiles
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int log_init(char *logfile) {
|
||||
if ((log_fd = fopen(logfile, "a" )) == NULL) {
|
||||
log_print("log_open('%s'): %s", logfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* beim beenden log schliessen */
|
||||
if (atexit(log_close) != 0) {
|
||||
log_print("log_open(): atexit()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_print("==========================");
|
||||
return 1;
|
||||
}
|
||||
|
|
29
src/plugin.c
29
src/plugin.c
|
@ -27,19 +27,17 @@
|
|||
#include "netpkt.h"
|
||||
#include "list.h"
|
||||
|
||||
/* liste der geladenen plugins */
|
||||
/** liste der geladenen plugins */
|
||||
static LIST_HEAD(plugin_list);
|
||||
|
||||
/* sichert die plugin list UND die plugins ab */
|
||||
/** sichert die plugin liste UND die plugins selbst ab */
|
||||
static pthread_mutex_t plugin_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/**
|
||||
* plugin_load()
|
||||
* laedt ein shared object,
|
||||
* fuehrt wenn vorhanden init() aus
|
||||
* und haengt den plugin an das ende der liste
|
||||
* laedt ein plugin und fuegt es in die plugin liste ein
|
||||
*
|
||||
* @param char *name
|
||||
* @param *name filename des plugins
|
||||
* @return false on error
|
||||
*/
|
||||
int plugin_load(char *name) {
|
||||
|
@ -49,19 +47,24 @@ int plugin_load(char *name) {
|
|||
|
||||
dlerror();
|
||||
|
||||
/* shared objekt oeffnen */
|
||||
if ((tmp = dlopen(name, RTLD_NOW))) {
|
||||
|
||||
/* plugin struct suchen */
|
||||
if ((plugin = dlsym(tmp, "plugin"))) {
|
||||
plugin->dlref = tmp;
|
||||
|
||||
section = config_get_section(plugin->name);
|
||||
log_print("loading plugin '%s'", plugin->name);
|
||||
|
||||
/* wenn vorhanden, init aufrufen */
|
||||
if (!plugin->init || (plugin->init(section))) {
|
||||
pthread_mutex_lock(&plugin_lock);
|
||||
list_add_tail(&plugin->list, &plugin_list);
|
||||
pthread_mutex_unlock(&plugin_lock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_print("failed to load '%s'", name);
|
||||
dlclose(tmp);
|
||||
return 0;
|
||||
|
@ -96,8 +99,6 @@ int plugin_load_all() {
|
|||
/**
|
||||
* plugin_unload_all()
|
||||
* entfernt alle plugins aus der liste,
|
||||
* ruft wenn vorhanden fini() auf
|
||||
* und entlaed das shared object
|
||||
*
|
||||
* @return false on error
|
||||
*/
|
||||
|
@ -120,7 +121,7 @@ int plugin_unload_all() {
|
|||
|
||||
/**
|
||||
* plugins_scan()
|
||||
* ruft die scan() Funktionen der Plugins auf (wenn vorhanden)
|
||||
* ruft die scan() Funktionen der Plugins auf
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
|
@ -129,6 +130,7 @@ int plugins_scan(void) {
|
|||
|
||||
pthread_mutex_lock(&plugin_lock);
|
||||
list_for_each_entry(plugin, &plugin_list, list)
|
||||
/* wenn vorhanden die scan funktion aufrufen */
|
||||
if (plugin->scan && !plugin->scan())
|
||||
log_print("plugin %s: scan error", plugin->name);
|
||||
|
||||
|
@ -138,10 +140,10 @@ int plugins_scan(void) {
|
|||
|
||||
/**
|
||||
* plugins_parse()
|
||||
* ruft die parse() Funktionen der Plugins auf (wenn vorhanden)
|
||||
* ruft die parse() Funktionen der Plugins auf
|
||||
* bis ein Plugin das Paket annimmt
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @param *pkt das zu parsene paket
|
||||
* @return false wenn kein Plugin das Paket angenommen hat
|
||||
*/
|
||||
int plugins_parse(struct net_pkt *pkt) {
|
||||
|
@ -149,6 +151,7 @@ int plugins_parse(struct net_pkt *pkt) {
|
|||
|
||||
pthread_mutex_lock(&plugin_lock);
|
||||
list_for_each_entry(plugin, &plugin_list, list) {
|
||||
/* wenn vorhanden die parse funktion aufrufen */
|
||||
if (plugin->parse && plugin->parse(pkt)) {
|
||||
pthread_mutex_unlock(&plugin_lock);
|
||||
return 1;
|
||||
|
@ -161,9 +164,9 @@ int plugins_parse(struct net_pkt *pkt) {
|
|||
|
||||
/**
|
||||
* plugins_gc()
|
||||
* ruft die gc() Funktionen der Plugins auf (wenn vorhanden)
|
||||
* ruft die gc() Funktionen der Plugins auf
|
||||
*
|
||||
* @param unsigned long timeout
|
||||
* @param timeout timeout interval in sekunden
|
||||
* @return true
|
||||
*/
|
||||
int plugins_gc(unsigned long timeout) {
|
||||
|
|
|
@ -38,31 +38,34 @@
|
|||
|
||||
/**
|
||||
* pkt_queue_portarr()
|
||||
* erzeugt ein net_pkt aus den parametern und legt es in die send queue
|
||||
* sendet an eine reihe von ports
|
||||
*
|
||||
* @param char *dstip - pointer auf eine IP, wenn NULL wird broadcast angenommen
|
||||
* @param struct scan_ports *port_arr
|
||||
* @param char *buf - pointer auf den zu sendenen speicherbereich
|
||||
* @param unsigned int size - groesse des speicherbereichs
|
||||
* @param *dstip destination IP, wenn NULL wird broadcast angenommen
|
||||
* @param *portarr ports an die gesendet wird
|
||||
* @param *buf daten die gesendet werden
|
||||
* @param size groesse der daten
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int pkt_send_portarr(struct in_addr *dstip, struct scan_ports *portarr, char *buf, unsigned int size) {
|
||||
unsigned short port;
|
||||
int ret = 1;
|
||||
|
||||
while (portarr && portarr->portlo) {
|
||||
for (port = portarr->portlo; port <= portarr->porthi; port++)
|
||||
pkt_send(dstip, port, buf, size);
|
||||
if (!pkt_send(dstip, port, buf, size))
|
||||
ret = 0;
|
||||
|
||||
portarr++;
|
||||
}
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* pkt_check_portarr()
|
||||
* prueft ob der src-port des pakets in der portliste vorhanden ist
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @param struct scan_ports *port_arr
|
||||
* @param *pkt paket vom gameserver
|
||||
* @param *portarr ports die angenommen werden
|
||||
* @return die gameid der portrange oder 0 wenn nicht vorhanden
|
||||
*/
|
||||
int pkt_check_portarr(struct net_pkt *pkt, struct scan_ports *portarr) {
|
||||
|
@ -81,17 +84,20 @@ int pkt_check_portarr(struct net_pkt *pkt, struct scan_ports *portarr) {
|
|||
* pkt_memcmp()
|
||||
* vergleicht das Paket mit einem Speicherbereich
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @param unsigned int offset
|
||||
* @param char *search
|
||||
* @param unsigned int size
|
||||
* @param *pkt paket vom gameserver
|
||||
* @param offset offset ab dem verglichen wird
|
||||
* @param *search daten nach denen gesucht wird
|
||||
* @param size laenge der daten
|
||||
* @return true wenn gleich
|
||||
*
|
||||
* @todo return false wenn offset + size >= pkt->size ?
|
||||
*/
|
||||
int pkt_memcmp(struct net_pkt *pkt, unsigned int offset, char *search, unsigned int size) {
|
||||
|
||||
|
||||
if (offset >= pkt->size)
|
||||
return 1;
|
||||
|
||||
/* nicht ueber das paket hinaus vergleichen */
|
||||
if (offset + size >= pkt->size)
|
||||
size = pkt->size - offset;
|
||||
|
||||
|
@ -102,11 +108,11 @@ int pkt_memcmp(struct net_pkt *pkt, unsigned int offset, char *search, unsigned
|
|||
* pkt_memmem()
|
||||
* sucht einen Speicherbereich in dem Paket
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @param unsigned int offset
|
||||
* @param char *search
|
||||
* @param unsigned int size
|
||||
* @return pointer auf den string im Paket
|
||||
* @param *pkt paket vom gameserver
|
||||
* @param offset offset ab dem gesucht wird
|
||||
* @param *search daten nach denen gesucht wird
|
||||
* @param size laenge der daten
|
||||
* @return pointer auf den string im Paket, oder NULL wenn nicht gefunden
|
||||
*/
|
||||
void * pkt_memmem(struct net_pkt *pkt, unsigned int offset, char *search, unsigned int size) {
|
||||
if (offset >= pkt->size)
|
||||
|
@ -119,8 +125,8 @@ void * pkt_memmem(struct net_pkt *pkt, unsigned int offset, char *search, unsign
|
|||
* server_add_pkt()
|
||||
* fuegt der serverliste einen server hinzu
|
||||
*
|
||||
* @param unsigned int gameid
|
||||
* @param struct net_pkt *pkt
|
||||
* @param gameid gameid des gameservers
|
||||
* @param *pkt daten vom gameserver (fuer ip/port)
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int server_add_pkt(unsigned int gameid, struct net_pkt *pkt) {
|
||||
|
@ -131,7 +137,7 @@ int server_add_pkt(unsigned int gameid, struct net_pkt *pkt) {
|
|||
* pkt_ntoa()
|
||||
* gibt die IP des Pakets als String zurueck
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @param *pkt daten vom gameserver
|
||||
* @return pointer auf String
|
||||
*/
|
||||
char * pkt_ntoa(struct net_pkt *pkt) {
|
||||
|
@ -142,8 +148,8 @@ char * pkt_ntoa(struct net_pkt *pkt) {
|
|||
* pkt_getport()
|
||||
* gibt den Port des Pakets als short zurueck
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @return portnr
|
||||
* @param *pkt daten vom gameserver
|
||||
* @return portnummer
|
||||
*/
|
||||
unsigned short pkt_getport(struct net_pkt *pkt) {
|
||||
return ntohs(pkt->addr.sin_port);
|
||||
|
@ -151,20 +157,22 @@ unsigned short pkt_getport(struct net_pkt *pkt) {
|
|||
|
||||
/**
|
||||
* pkt_atoi()
|
||||
* gibt den integer in dem paket ab der position zurueck
|
||||
* gibt die dezimalzahl in dem paket ab einer position zurueck
|
||||
*
|
||||
* @param struct net_pkt *pkt
|
||||
* @return int
|
||||
* @param *pkt daten vom gameserver
|
||||
* @param *p pointer auf den begin des integers
|
||||
* @return wert des integers oder 0 bei fehler
|
||||
*/
|
||||
int pkt_atoi(struct net_pkt *pkt, void *p) {
|
||||
int val = 0;
|
||||
void *max = ((void *)pkt->buf + pkt->size);
|
||||
char *c = p;
|
||||
|
||||
/* check lower bounds */
|
||||
/* untere grenze abtesten */
|
||||
if ((void *)pkt->buf > p || p > max)
|
||||
return 0;
|
||||
|
||||
/* ziffern einlesen */
|
||||
while (isdigit(*c) && (void *)c < max)
|
||||
val = (val * 10) + (*c++ - 0x30);
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
|
||||
#define DEBUG 1
|
||||
|
||||
/* die interne serverliste */
|
||||
/** interne serverliste */
|
||||
static LIST_HEAD(serverlist);
|
||||
|
||||
/* sichert die server liste */
|
||||
/** sichert die interne serverliste */
|
||||
static pthread_mutex_t serverlist_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* scan socket */
|
||||
|
@ -49,8 +49,8 @@ static int scan_sock;
|
|||
* server_cmp()
|
||||
* LIST_FIND helper
|
||||
*
|
||||
* @param struct game_server *a
|
||||
* @param struct game_server *b
|
||||
* @param *a gameserver 1
|
||||
* @param *b gameserver 2
|
||||
* @return true wenn es sich um den selben server handelt
|
||||
*/
|
||||
static inline int server_cmp(const struct game_server *a, struct game_server *b) {
|
||||
|
@ -60,14 +60,13 @@ static inline int server_cmp(const struct game_server *a, struct game_server *b)
|
|||
|
||||
/**
|
||||
* server_add()
|
||||
* fuegt der internen serverliste einen server hinzu
|
||||
* wenn dieser server schon in der liste vorhanden ist, wird nur
|
||||
* die modtime angepasst
|
||||
* wenn der server noch nicht in der internen liste vorhanden ist
|
||||
* wird er hinzugefuegt, ansonsten nur die modtime angepasst
|
||||
*
|
||||
* @param unsigned int gameid
|
||||
* @param struct in_addr ip
|
||||
* @param u_int16_t port1
|
||||
* @param u_int16_t port2
|
||||
* @param gameid gameid des servers
|
||||
* @param ip ip des servers
|
||||
* @param port1 erster port
|
||||
* @param port2 zweiter port
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int server_add(u_int16_t gameid, u_int32_t ip, u_int16_t port1, u_int16_t port2) {
|
||||
|
@ -113,7 +112,7 @@ int server_add(u_int16_t gameid, u_int32_t ip, u_int16_t port1, u_int16_t port2)
|
|||
* loescht alte server aus der liste
|
||||
* baut aus den verbleibenden die client_liste auf
|
||||
*
|
||||
* @param long timeout
|
||||
* @param timeout timeout in sekunden
|
||||
*/
|
||||
static void serverlist_refresh(long timeout) {
|
||||
struct game_server *server, *tmp;
|
||||
|
@ -146,25 +145,27 @@ static void serverlist_refresh(long timeout) {
|
|||
* pkt_send()
|
||||
* schickt ein paket ab
|
||||
*
|
||||
* @param struct in_addr *dstip - pointer auf eine IP, wenn NULL wird broadcast angenommen
|
||||
* @param unsigned int dstport - destination port
|
||||
* @param char *buf - pointer auf den zu sendenen speicherbereich
|
||||
* @param unsigned int size - groesse des speicherbereichs
|
||||
* @param *dstip destination IP, wenn NULL wird broadcast angenommen
|
||||
* @param dstport destination port
|
||||
* @param *buf datenbereich der gesendet wird
|
||||
* @param size groesse der daten
|
||||
* @return false bei fehler
|
||||
*/
|
||||
int pkt_send(struct in_addr *dstip, unsigned int dstport, char *buf, unsigned int size) {
|
||||
struct sockaddr_in addr;
|
||||
int ret = 1;
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(dstport);
|
||||
addr.sin_addr.s_addr = (dstip ? dstip->s_addr : 0xFFFFFFFF);
|
||||
|
||||
//inet_aton("10.4.1.1", &addr.sin_addr);
|
||||
|
||||
if (sendto(scan_sock, buf, size, 0, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||
if (sendto(scan_sock, buf, size, 0, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
log_print("scan_send(): sendto()");
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
usleep(10000);
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,6 +269,7 @@ static void scan_close() {
|
|||
/**
|
||||
* scan_init()
|
||||
* initialisiert den socket fuer den server scan
|
||||
*
|
||||
* @return false on error
|
||||
*/
|
||||
int scan_init() {
|
||||
|
|
Loading…
Reference in New Issue