The Assimilation Project  based on Assimilation version 1.1.7.1474836767
pinger.c File Reference

Test code that uses reliable UDP for pinging... More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netaddr.h>
#include <frametypes.h>
#include <reliableudp.h>
#include <authlistener.h>
#include <compressframe.h>
#include <cryptframe.h>
#include <cryptcurve25519.h>
#include <intframe.h>
#include <cstringframe.h>
#include <addrframe.h>
#include <ipportframe.h>
#include <seqnoframe.h>
#include <nvpairframe.h>
#include <packetdecoder.h>
#include <sodium.h>
Include dependency graph for pinger.c:

Go to the source code of this file.

Macros

#define CRYPTO_KEYID   "pinger"
 
#define CRYPTO_IDENTITY   "us chickens"
 
#define PORT   19840
 
#define RCVLOSS   0.05
 
#define XMITLOSS   0.05
 

Functions

void obey_pingpong (AuthListener *, FrameSet *fs, NetAddr *)
 
void obey_connshut (AuthListener *, FrameSet *, NetAddr *)
 
gboolean exit_when_connsdown (gpointer)
 
void usage (const char *cmdname)
 
int main (int argc, char **argv)
 

Variables

ReliableUDPtransport = NULL
 
int pongcount = 2
 
int maxpingcount = 10
 
GMainLoop * loop = NULL
 
gboolean encryption_enabled = FALSE
 
guint pongsize = 32*1024
 
ObeyFrameSetTypeMap doit []
 
GHashTable * theircounts = NULL
 
GHashTable * ourcounts = NULL
 

Detailed Description

Test code that uses reliable UDP for pinging...

See brief statement...

This file is part of the Assimilation Project.

Author
© Copyright 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file pinger.c.

Macro Definition Documentation

#define CRYPTO_IDENTITY   "us chickens"

Definition at line 46 of file pinger.c.

Referenced by main(), and obey_pingpong().

#define CRYPTO_KEYID   "pinger"

Definition at line 45 of file pinger.c.

Referenced by main(), and obey_pingpong().

#define PORT   19840

Definition at line 47 of file pinger.c.

Referenced by main().

#define RCVLOSS   0.05

Definition at line 50 of file pinger.c.

Referenced by main().

#define XMITLOSS   0.05

Definition at line 51 of file pinger.c.

Referenced by main().

Function Documentation

gboolean exit_when_connsdown ( gpointer  unused)

Definition at line 90 of file pinger.c.

References _ReliableUDP::_protocol, _FsProtocol::activeconncount, and loop.

Referenced by obey_pingpong().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 246 of file pinger.c.

References anyaddr, _Listener::associate, authlistener_new(), _IntFrame::baseclass, _NetIOudp::baseclass, _CompressFrame::baseclass, _AuthListener::baseclass, _NetGSource::baseclass, _ReliableUDP::baseclass, _NetAddr::baseclass, _SignFrame::baseclass, _NetIO::bindaddr(), CASTTOCLASS, COMPRESS_ZLIB, compressframe_new(), _CompressFrame::compression_threshold, obsolete_cma::config, configcontext_new(), CONFIGNAME_COMPRESS, CONFIGNAME_OUTSIG, cryptcurve25519_gen_temp_keypair(), cryptcurve25519_new_generic(), cryptframe_associate_identity(), cryptframe_set_dest_key_id(), cryptframe_set_encryption_method(), cryptframe_set_signing_key_id(), cryptframe_shutdown(), CRYPTO_IDENTITY, CRYPTO_KEYID, DIMOF, _Listener::dissociate, _NetIO::enablepktloss(), encryption_enabled, frameset_append_frame(), frameset_new(), FRAMESETTYPE_SEQPING, FRAMETYPE_CINTVAL, FRAMETYPE_COMPRESS, FRAMETYPEMAP, _NetIO::getsockbufsize(), intframe_new(), _NetAddr::islocal, loop, maxpingcount, netaddr_g_hash_equal(), netaddr_g_hash_hash(), netaddr_ipv6_new(), netaddr_string_new(), netgsource_new(), netpkt, ourcounts, packetdecoder_new(), pongcount, pongsize, PORT, proj_class_dump_live_objects(), proj_class_finalize_sys(), proj_class_incr_debug(), proj_class_live_object_count(), RCVLOSS, REF, reliableudp_new(), _NetIO::sendareliablefs(), _ConfigContext::setframe, _IntFrame::setint, _NetIO::setpktloss(), _NetAddr::setport, _NetIO::setsockbufsize(), signframe_glib_new(), theircounts, _NetAddr::toIPv6, _AssimObj::toString, UNREF, UNREF2, UNREF3, usage(), and XMITLOSS.

Here is the call graph for this function:

void obey_connshut ( AuthListener unused,
FrameSet unusedfs,
NetAddr unusedaddr 
)

Definition at line 101 of file pinger.c.

void usage ( const char *  cmdname)

Definition at line 231 of file pinger.c.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

Initial value:
= {
{FRAMESETTYPE_SEQPONG, obey_pingpong},
{0, NULL}
}
#define FRAMESETTYPE_SEQPING
Are you alive? (can come from anyone)
Definition: framesettypes.h:47
void obey_pingpong(AuthListener *, FrameSet *fs, NetAddr *)
Definition: pinger.c:110
#define FRAMESETTYPE_SEQPONG
I am alive (can go to anyone)
Definition: framesettypes.h:48
void obey_connshut(AuthListener *, FrameSet *, NetAddr *)
Definition: pinger.c:101
#define FRAMESETTYPE_CONNSHUT
Shutting down this connection (can also come from CMA)
Definition: framesettypes.h:37

Definition at line 79 of file pinger.c.

gboolean encryption_enabled = FALSE

Definition at line 76 of file pinger.c.

Referenced by main(), and obey_pingpong().

GMainLoop* loop = NULL

Definition at line 75 of file pinger.c.

Referenced by exit_when_connsdown(), and main().

int maxpingcount = 10

Definition at line 74 of file pinger.c.

Referenced by main(), and obey_pingpong().

GHashTable* ourcounts = NULL

Definition at line 87 of file pinger.c.

Referenced by main(), and obey_pingpong().

int pongcount = 2

Definition at line 73 of file pinger.c.

Referenced by main(), and obey_pingpong().

guint pongsize = 32*1024

Definition at line 77 of file pinger.c.

Referenced by main(), and obey_pingpong().

GHashTable* theircounts = NULL

Definition at line 86 of file pinger.c.

Referenced by main(), and obey_pingpong().