The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cmalib.h File Reference

Basic utility functions for the CMA. More...

#include <projectcommon.h>
#include <configcontext.h>
#include <netaddr.h>
#include <frameset.h>
Include dependency graph for cmalib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Detailed Description

Basic utility functions 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.h.

Function Documentation

WINEXPORT 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:

WINEXPORT 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: