More of client filter codes

git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@23 3ce903b1-3385-4e86-93cd-f9a4a239f7ac
This commit is contained in:
Matti Aarnio 2008-02-29 00:27:36 +00:00
parent b9a0753da8
commit b61cd9e21a
9 changed files with 263 additions and 186 deletions

View File

@ -29,7 +29,7 @@ INSTALL= $(srcdir)/install-sh
INSTALL_PROGRAM=$(INSTALL) -m 755
INSTALL_DATA= $(INSTALL) -m 644
LIBS= @LIBS@ -lpthread @LIBSOCKET@
LIBS= @LIBM@ @LIBPTHREAD@ @LIBSOCKET@ @LIBGETNAMEINFO@
# Linux:
# -lpthread
@ -70,7 +70,7 @@ distclean: clean
rm -rf autom4te.cache
aprsc: $(OBJS)
$(LD) $(LDFLAGS) -o aprsc $(OBJS) $(LIBS)
$(LD) $(LDFLAGS) -g -o aprsc $(OBJS) $(LIBS)
%.o: %.c VERSION Makefile
$(CC) $(CFLAGS) -c $<

View File

@ -1,5 +1,8 @@
/* ac-hdrs.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `atan2f' function. */
#undef HAVE_ATAN2F
/* Define to 1 if you have the `gai_strerror' function. */
#undef HAVE_GAI_STRERROR
@ -12,15 +15,6 @@
/* Define to 1 if you have the `inet_pton' function. */
#undef HAVE_INET_PTON
/* Define to 1 if you have the `openpty' function. */
#undef HAVE_OPENPTY
/* pthread library */
#undef HAVE_PTHREAD
/* Define to 1 if you have the `pthread_exit' function. */
#undef HAVE_PTHREAD_EXIT
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET

170
src/configure vendored
View File

@ -626,6 +626,9 @@ CPP
GREP
EGREP
LD
LIBM
LIBPTHREAD
LIBGETNAMEINFO
LIBSOCKET
LIBOBJS
LTLIBOBJS'
@ -3056,7 +3059,7 @@ LD="$LD"
for ac_func in openpty
for ac_func in atan2f
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
@ -3147,13 +3150,13 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then
_ACEOF
else
{ echo "$as_me:$LINENO: checking for openpty in -lutil" >&5
echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; }
if test "${ac_cv_lib_util_openpty+set}" = set; then
{ echo "$as_me:$LINENO: checking for atan2f in -lm" >&5
echo $ECHO_N "checking for atan2f in -lm... $ECHO_C" >&6; }
if test "${ac_cv_lib_m_atan2f+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lutil $LIBS"
LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -3167,11 +3170,11 @@ cat >>conftest.$ac_ext <<_ACEOF
#ifdef __cplusplus
extern "C"
#endif
char openpty ();
char atan2f ();
int
main ()
{
return openpty ();
return atan2f ();
;
return 0;
}
@ -3194,25 +3197,22 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_util_openpty=yes
ac_cv_lib_m_atan2f=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_util_openpty=no
ac_cv_lib_m_atan2f=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5
echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; }
if test $ac_cv_lib_util_openpty = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_OPENPTY 1
_ACEOF
LIBS="$LIBS -lutil"
{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_atan2f" >&5
echo "${ECHO_T}$ac_cv_lib_m_atan2f" >&6; }
if test $ac_cv_lib_m_atan2f = yes; then
LIBM="-lm"
fi
fi
@ -3220,100 +3220,9 @@ done
for ac_func in pthread_exit
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
{ echo "$as_me:$LINENO: checking for pthead_exit in -lpthread" >&5
echo $ECHO_N "checking for pthead_exit in -lpthread... $ECHO_C" >&6; }
if test "${ac_cv_lib_pthread_pthead_exit+set}" = set; then
{ echo "$as_me:$LINENO: checking for pthread_exit in -lpthread" >&5
echo $ECHO_N "checking for pthread_exit in -lpthread... $ECHO_C" >&6; }
if test "${ac_cv_lib_pthread_pthread_exit+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -3331,11 +3240,11 @@ cat >>conftest.$ac_ext <<_ACEOF
#ifdef __cplusplus
extern "C"
#endif
char pthead_exit ();
char pthread_exit ();
int
main ()
{
return pthead_exit ();
return pthread_exit ();
;
return 0;
}
@ -3358,30 +3267,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_pthread_pthead_exit=yes
ac_cv_lib_pthread_pthread_exit=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_pthread_pthead_exit=no
ac_cv_lib_pthread_pthread_exit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthead_exit" >&5
echo "${ECHO_T}$ac_cv_lib_pthread_pthead_exit" >&6; }
if test $ac_cv_lib_pthread_pthead_exit = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_PTHREAD 1
_ACEOF
LIBS="$LIBS -lpthread"
{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_exit" >&5
echo "${ECHO_T}$ac_cv_lib_pthread_pthread_exit" >&6; }
if test $ac_cv_lib_pthread_pthread_exit = yes; then
LIBPTHREAD="-lpthread"
fi
fi
done
@ -3538,23 +3441,13 @@ fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_getnameinfo" >&5
echo "${ECHO_T}$ac_cv_lib_nsl_getnameinfo" >&6; }
if test $ac_cv_lib_nsl_getnameinfo = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GETNAMEINFO 1
_ACEOF
LIBS="$LIBS -lnsl"
LIBGETNAMEINFO="-lnsl"
fi
fi
done
#
# We check for various libraries
# - SysVr4 style of "-lsocket" at first (unless in libc)
# The hallmark is connect() routine (we presume)
#
ac_cv_libsocket_both=1
{ echo "$as_me:$LINENO: checking for connect" >&5
echo $ECHO_N "checking for connect... $ECHO_C" >&6; }
@ -4558,6 +4451,8 @@ echo "${ECHO_T}$ac_cv_func_res_mkquery" >&6; }
LIBS="$LIBS"
ac_config_files="$ac_config_files Makefile"
@ -5225,12 +5120,15 @@ CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
LD!$LD$ac_delim
LIBM!$LIBM$ac_delim
LIBPTHREAD!$LIBPTHREAD$ac_delim
LIBGETNAMEINFO!$LIBGETNAMEINFO$ac_delim
LIBSOCKET!$LIBSOCKET$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -22,7 +22,6 @@ if test -z "$LD" ; then
fi
AC_SUBST(LD,"$LD")
dnl Check for headers.
dnl AC_CHECK_HEADERS(pty.h)
@ -30,24 +29,28 @@ dnl Checks for libraries.
dnl Checks for library functions.
AC_CHECK_FUNCS(openpty,,
AC_CHECK_LIB(util, openpty,
[AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
AC_SUBST(LIBM)
AC_CHECK_FUNCS(atan2f,,
AC_CHECK_LIB(m, atan2f,
[LIBM="-lm"]))
AC_CHECK_FUNCS(pthread_exit,,
AC_CHECK_LIB(pthread, pthead_exit,
[AC_DEFINE([HAVE_PTHREAD],[1],[pthread library])] [LIBS="$LIBS -lpthread"]))
AC_SUBST(LIBPTHREAD)
dnl AC_CHECK_FUNCS(pthread_exit,,
AC_CHECK_LIB(pthread, pthread_exit,
[LIBPTHREAD="-lpthread"])
dnl)
dnl Solaris resolver solution:
AC_SUBST(LIBGETNAMEINFO)
AC_CHECK_FUNCS(getnameinfo,,
AC_CHECK_LIB(nsl, getnameinfo,
[AC_DEFINE([HAVE_GETNAMEINFO],[1],[getnameinfo function])] [LIBS="$LIBS -lnsl"]))
[LIBGETNAMEINFO="-lnsl"]))
#
# We check for various libraries
# - SysVr4 style of "-lsocket" at first (unless in libc)
# The hallmark is connect() routine (we presume)
#
dnl
dnl We check for various libraries
dnl - SysVr4 style of "-lsocket" at first (unless in libc)
dnl The hallmark is connect() routine (we presume)
dnl
AC_SUBST(LIBSOCKET)dnl
ac_cv_libsocket_both=1
AC_CHECK_FUNC(connect, ac_cv_libsocket_both=0)
@ -154,6 +157,7 @@ AC_CHECK_FUNC(res_init) # Can be found without any libs ? Or needs BIND libres
AC_CHECK_FUNC(res_mkquery)
AC_SUBST(LIBS,"$LIBS")
dnl Output files
AC_CONFIG_FILES([Makefile])

View File

@ -2,8 +2,11 @@
#include <strings.h>
#include <ctype.h>
#include <math.h>
#include "hmalloc.h"
#include "hlog.h"
#include "worker.h"
#include "filter.h"
/*
@ -33,13 +36,90 @@
struct filter_t {
struct filter_t *next;
char type; /* 1 char */
char negate; /* boolean flag */
char type; /* 1 char */
char negation; /* boolean flag */
const char *text; /* filter text as is */
float f[4]; /* parsed floats, if any */
float f_latN, f_lonE, f_latS, f_lonW;
/* parsed floats, if any */
#define f_dist f_latS /* for R filter */
#define f_coslat f_lonW /* for R filter */
};
/*
#
# Input: This[La] Source Latitude, in radians
# This[Lo] Source Longitude, in radians
# That[La] Destination Latitude, in radians
# That[Lo] Destination Longitude, in radians
# Output: R[s] Distance, in kilometers
#
function maidenhead_km_distance($This, $That) {
#Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine",
#Sky and Telescope, vol. 68, no. 2, 1984, p. 159):
$dlon = $That[Lo] - $This[Lo];
$dlat = $That[La] - $This[La];
$sinDlat2 = sin($dlat/2);
$sinDlon2 = sin($dlon/2);
$a = ($sinDlat2 * $sinDlat2 +
cos($This[La]) * cos($That[La]) * $sinDlon2 * $sinDlon2);
# The Haversine Formula can be expressed in terms of a two-argument
# inverse tangent function, atan2(y,x), instead of an inverse sine
# as follows (no bulletproofing is needed for an inverse tangent):
$c = 2.0 * atan2( sqrt($a), sqrt(1.0-$a) );
# $d = R * $c ; # Radius of ball times angle [radians] ...
$R[s] = rad2deg($c) * 111.2;
return($R);
}
*/
float maidenhead_km_distance(struct filter_t *f, struct pbuf_t *pb)
{
float dlat = f->f_latN - pb->lat;
float dlon = f->f_lonE - pb->lng;
float sindlat2 = sinf(dlat * 0.5);
float sindlon2 = sinf(dlon * 0.5);
float a, c;
if (!(pb->cos_lat)) { /* gets re-calculated only at exact poles: +- pi/2 */
pb->cos_lat = cosf(pb->lat);
}
a = (sindlat2 * sindlat2 +
f->f_coslat * pb->cos_lat * sindlon2 * sindlon2);
c = 2.0 * atan2f( sqrtf(a), sqrtf(1.0 - a));
return ((111.2 * 180.0 / M_PI) * c);
}
float filter_lat2rad(float lat)
{
/* return atan(gm4anb_b2pera2 * tan(lat * (M_PI / 180.0))); */
return (lat * (M_PI / 180.0));
}
float filter_lon2rad(float lon)
{
return (lon * (M_PI / 180.0));
}
int filter_parse(struct client_t *c, char *filt)
{
struct filter_t *f, f0;
@ -48,7 +128,7 @@ int filter_parse(struct client_t *c, char *filt)
memset(&f0, 0, sizeof(f0));
if (*filt == '-') {
f0.negate = 1;
f0.negation = 1;
++filt;
}
f0.type = *filt;
@ -63,29 +143,38 @@ int filter_parse(struct client_t *c, char *filt)
/* a/latN/lonW/latS/lonE Area filter */
i = sscanf(filt, "a/%f/%f/%f/%f",
&f0.f[0],&f0.f[1],&f0.f[2],&f0.f[3]);
&f0.f_latN, &f0.f_lonW, &f0.f_latS, &f0.f_lonE);
if (i != 4) return -1;
if (!( -90.01 < f0.f[0] && f0.f[0] < 90.01)) return -2;
if (!(-180.01 < f0.f[1] && f0.f[1] < 180.01)) return -2;
if (!( -90.01 < f0.f[2] && f0.f[2] < 90.01)) return -2;
if (!(-180.01 < f0.f[3] && f0.f[3] < 180.01)) return -2;
if (f0.f[0] < f0.f[2]) return -3; /* expect: latN >= latS */
if (f0.f[1] > f0.f[3]) return -3; /* expect: lonW <= lonE */
f0.f[0] *= (3.1415926/180.0); /* deg-to-radians */
f0.f[1] *= (3.1415926/180.0); /* deg-to-radians */
f0.f[2] *= (3.1415926/180.0); /* deg-to-radians */
f0.f[3] *= (3.1415926/180.0); /* deg-to-radians */
if (!( -90.01 < f0.f_latN && f0.f_latN < 90.01)) return -2;
if (!(-180.01 < f0.f_lonW && f0.f_lonW < 180.01)) return -2;
if (!( -90.01 < f0.f_latS && f0.f_latS < 90.01)) return -2;
if (!(-180.01 < f0.f_lonE && f0.f_lonE < 180.01)) return -2;
if (f0.f_latN < f0.f_latS) return -3; /* expect: latN >= latS */
if (f0.f_lonW > f0.f_lonE) return -3; /* expect: lonW <= lonE */
f0.f_latN = filter_lat2rad(f0.f_latN);
f0.f_lonW = filter_lon2rad(f0.f_lonW);
f0.f_latS = filter_lat2rad(f0.f_latS);
f0.f_lonE = filter_lon2rad(f0.f_lonE);
break;
case 'r':
/* r/lat/lon/dist Range filter */
i = sscanf(filt, "r/%f/%f/%f",
&f0.f[0],&f0.f[1],&f0.f[2]);
&f0.f_latN, &f0.f_lonW, &f0.f_dist);
if (i != 3) return -1;
if (!( -90.01 < f0.f[0] && f0.f[0] < 90.01)) return -2;
if (!(-180.01 < f0.f[1] && f0.f[1] < 180.01)) return -2;
f0.f[0] *= (3.1415926/180.0); /* deg-to-radians */
f0.f[1] *= (3.1415926/180.0); /* deg-to-radians */
if (!( -90.01 < f0.f_latN && f0.f_latN < 90.01)) return -2;
if (!(-180.01 < f0.f_lonW && f0.f_lonW < 180.01)) return -2;
f0.f_latN = filter_lat2rad(f0.f_latN);
f0.f_lonW = filter_lon2rad(f0.f_lonW);
f0.f_coslat = cosf( f0.f_latN ); /* Store pre-calculated COS of LAT */
break;
default:;
@ -122,5 +211,74 @@ void filter_free(struct filter_t *f)
int filter_process(struct client_t *c, struct pbuf_t *pb)
{
struct filter_t *f = c->filterhead;
for ( ; f; f = f->next ) {
switch (f->type) {
case 'a': /* Area filters */
if (pb->packettype & T_POSITION) {
if ((pb->lat > f->f_latN) ||
(pb->lat < f->f_latS) ||
(pb->lng > f->f_lonE) || /* East POSITIVE ! */
(pb->lng < f->f_lonW)) {
/* Outside the box */
if (f->negation)
return 1;
} else {
/* Inside the box */
if (!f->negation)
return 1;
}
}
break;
case 'r': /* Range filters */
if (pb->packettype & T_POSITION) {
float r = maidenhead_km_distance(f, pb);
if ((!f->negation) && (r < f->f_dist))
return 1; /* Range is less than given limit */
if ((f->negation) && (r > f->f_dist))
return 1; /* Range is greater than given limit */
}
break;
case 'b': /* Budlist filter (w/ wild-card support) */
break;
case 'd': /* Digipeater filter (w/ wild-card support) */
break;
case 'e': /* Entry station filter (w/ wild-card support) */
break;
case 'o': /* Object filter (w/ wild-card support) */
break;
case 'p': /* Prefix filter */
break;
case 'q': /* q Construct filter */
break;
case 's': /* Symbol filter */
break;
case 'u': /* Unproto filter (w/ wild-card support) */
break;
case 't': /* Type filter (partial support) */
break;
case 'f': /* Friend Range filter (NOT supported?) */
break;
case 'm': /* My Range filter (NOT supported?) */
break;
default:
break;
}
}
return 1; /* for now pass all */
}

View File

@ -8,4 +8,7 @@ extern int filter_parse(struct client_t *c, char *filt);
extern void filter_free(struct filter_t *c);
extern int filter_process(struct client_t *c, struct pbuf_t *pb);
extern float filter_lat2rad(float lat);
extern float filter_lon2rad(float lon);
#endif /* FILTER_H */

View File

@ -30,6 +30,13 @@ void process_outgoing_single(struct worker_t *self, struct pbuf_t *pb)
if (c == pb->origin)
continue;
if (pb->flags & F_DUPE) {
/* Duplicate packet.
Don't send, unless client especially wants! */
/* TODO: When the client really wants this ? */
continue;
}
/* Process filters - check if this packet should be
sent to this client. */

View File

@ -1,4 +1,3 @@
/*
* A simple APRS parser for aprsc. Translated from Ham::APRS::FAP
* perl module (by OH2KKU).
@ -10,9 +9,11 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "parse_aprs.h"
#include "hlog.h"
#include "filter.h"
int parse_aprs_mice(struct pbuf_t *pb)
{
@ -95,10 +96,18 @@ int parse_aprs_uncompressed(struct pbuf_t *pb, char *body, const char *body_end)
fprintf(stderr, "\tlat %u %u.%u %c (%.3f) lng %u %u.%u %c (%.3f)\n",
lat_deg, lat_min, lat_min_frag, (int)lat_hemi, lat,
lng_deg, lng_min, lng_min_frag, (int)lng_hemi, lng);
/* Pre-calculations for A/R/F/M-filter tests */
pb->lat = lat;
pb->lng = lng;
pb->lat = filter_lat2rad(lat); /* deg-to-radians */
pb->cos_lat = 0.0;
/* pb->cos_lat = cosf(pb->lat); /* pre-calc for R/F/M-filters */
pb->lng = filter_lon2rad(lng); /* deg-to-radians */
pb->packettype |= T_POSITION; /* the packet has positional data */
return 1;
}
@ -133,6 +142,9 @@ int parse_aprs(struct worker_t *self, struct pbuf_t *pb)
if (!pb->info_start)
return 0;
pb->packettype = 0;
pb->flags = 0;
/* the following parsing logic has been translated from Ham::APRS::FAP
* Perl module to C

View File

@ -70,8 +70,9 @@ struct pbuf_t {
char *dstcall_end; /* end of dest callsign SSID */
char *info_start; /* pointer to start of info field */
float lat; /* if the packet is PT_POSITION, latitude and longitude go here */
float lng;
float lat; /* if the packet is PT_POSITION, latitude and longitude go here */
float lng; /* .. in RADIAN */
float cos_lat; /* pre-calculated COS of LATitude for radial distance filter */
struct sockaddr addr; /* where did we get it from (don't send it back) */
};