|
|
|
/*
|
|
|
|
* goose_receiver.h
|
|
|
|
*
|
|
|
|
* Copyright 2014 Michael Zillgith
|
|
|
|
*
|
|
|
|
* This file is part of libIEC61850.
|
|
|
|
*
|
|
|
|
* libIEC61850 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.
|
|
|
|
*
|
|
|
|
* libIEC61850 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 libIEC61850. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* See COPYING file for the complete license text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GOOSE_RECEIVER_H_
|
|
|
|
#define GOOSE_RECEIVER_H_
|
|
|
|
|
|
|
|
#include <goose_subscriber.h>
|
|
|
|
|
|
|
|
typedef struct sGooseReceiver* GooseReceiver;
|
|
|
|
|
|
|
|
GooseReceiver
|
|
|
|
GooseReceiver_create(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
GooseReceiver_setInterfaceId(GooseReceiver self, const char* interfaceId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Add a subscriber to this receiver instance
|
|
|
|
*
|
|
|
|
* NOTE: Do not call this function while the receiver is running (after GooseReceiver_start
|
|
|
|
* has been called)!
|
|
|
|
*
|
|
|
|
* \param self the GooseReceiver instance
|
|
|
|
* \param subscriber the GooseSubscriber instance to add
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
GooseReceiver_addSubscriber(GooseReceiver self, GooseSubscriber subscriber);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Remove a subscriber from this receiver instance
|
|
|
|
*
|
|
|
|
* NOTE: Do not call this function while the receiver is running (after GooseReceiver_start
|
|
|
|
* has been called)!
|
|
|
|
*
|
|
|
|
* \param self the GooseReceiver instance
|
|
|
|
* \param subscriber the GooseSubscriber instance to remove
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
GooseReceiver_removeSubscriber(GooseReceiver self, GooseSubscriber subscriber);
|
|
|
|
|
|
|
|
// call backup listener if message is not handled by a subscriber
|
|
|
|
void
|
|
|
|
GooseReceiver_setBackupListener(GooseReceiver self);
|
|
|
|
|
|
|
|
// start GOOSE receiver in a separate thread
|
|
|
|
void
|
|
|
|
GooseReceiver_start(GooseReceiver self);
|
|
|
|
|
|
|
|
void
|
|
|
|
GooseReceiver_stop(GooseReceiver self);
|
|
|
|
|
|
|
|
void
|
|
|
|
GooseReceiver_destroy(GooseReceiver self);
|
|
|
|
|
|
|
|
/***************************************
|
|
|
|
* Functions for non-threaded operation
|
|
|
|
***************************************/
|
|
|
|
void
|
|
|
|
GooseReceiver_startThreadless(GooseReceiver self);
|
|
|
|
|
|
|
|
void
|
|
|
|
GooseReceiver_stopThreadless(GooseReceiver self);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Parse GOOSE messages if they are available
|
|
|
|
*
|
|
|
|
* Call after reception of ethernet frame and periodically to to house keeping tasks
|
|
|
|
*
|
|
|
|
* \param self the receiver object
|
|
|
|
*
|
|
|
|
* \return true if a message was available and has been parsed, false otherwise
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
GooseReceiver_tick(GooseReceiver self);
|
|
|
|
|
|
|
|
#endif /* GOOSE_RECEIVER_H_ */
|