The Assimilation Project  based on Assimilation version 0.5.1435592714
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cmalib.c File Reference

Basic utility functins for the CMA. More...

#include <projectcommon.h>
#include <string.h>
#include <cmalib.h>
#include <frameset.h>
#include <intframe.h>
#include <ipportframe.h>
#include <cstringframe.h>
#include <frametypes.h>
Include dependency graph for cmalib.c:

Go to the source code of this file.

Functions

FrameSetcreate_sendexpecthb (ConfigContext *config, guint16 msgtype, NetAddr *addrs, int addrcount)
 Create a FrameSet class to send and expect heartbeats from the same sets of addresses. More...
 
FrameSetcreate_setconfig (ConfigContext *cfg)
 Create a FRAMESETTYPE_SETCONFIG FrameSet class. More...
 

Detailed Description

Basic utility functins for the CMA.

Small enough to leave in the client code.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 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 cmalib.c.

Function Documentation

FrameSet* create_sendexpecthb ( ConfigContext config,
guint16  msgtype,
NetAddr addrs,
int  addrcount 
)

Create a FrameSet class to send and expect heartbeats from the same sets of addresses.

Keep in mind the entire packet needs to fit in a UDP packet (< 64K). The port, hbtime, deadtime, and warntime parameters apply to all given addresses.

Parameters
[in]configProvides deadtime, port, etc.
[in]msgtypemessage type to create
[in,out]addrsAddresses to include
[in]addrcountCount of 'addrs' provided

Definition at line 42 of file cmalib.c.

References _CstringFrame::baseclass, _IntFrame::baseclass, _IpPortFrame::baseclass, _ConfigContext::baseclass, CONFIG_DEFAULT_DEADTIME, CONFIG_DEFAULT_HBTIME, CONFIG_DEFAULT_WARNTIME, configcontext_new(), CONFIGNAME_INTERVAL, CONFIGNAME_TIMEOUT, CONFIGNAME_WARNTIME, cstringframe_new(), frame_default_valuefinalize(), frameset_append_frame(), frameset_new(), FRAMETYPE_HBDEADTIME, FRAMETYPE_HBINTERVAL, FRAMETYPE_HBWARNTIME, FRAMETYPE_IPPORT, FRAMETYPE_RSCJSON, _ConfigContext::getint, intframe_new(), ipportframe_netaddr_new(), _IntFrame::setint, _ConfigContext::setint, _Frame::setvalue, _AssimObj::toString, UNREF, and UNREF2.

Referenced by fakecma_startup().

Here is the call graph for this function:

Here is the caller graph for this function:

FrameSet* create_setconfig ( ConfigContext cfg)

Create a FRAMESETTYPE_SETCONFIG FrameSet class.

We create it from a ConfigContext containing only values we want to go into the SETCONFIG message. We ignore frames in the ConfigContext (shouldn't be any). We are effectively a "friend" function to the ConfigContext object - either that or we cheated in order to iterate through its hash tables ;-)

Definition at line 111 of file cmalib.c.

References __FUNCTION__, _ConfigContext::_values, _CstringFrame::baseclass, _ConfigContext::baseclass, cstringframe_new(), frame_default_valuefinalize(), frameset_append_frame(), frameset_new(), FRAMESETTYPE_SETCONFIG, FRAMETYPE_CONFIGJSON, _Frame::setvalue, _AssimObj::toString, and UNREF2.

Referenced by fakecma_startup().

Here is the call graph for this function:

Here is the caller graph for this function: