OpenHIP 0.9svn1
/home/tomh/svn/openhip/hip/trunk/src/util/cfg-ifmap/ifmap_client.h
Go to the documentation of this file.
00001 /* -*- Mode:cc-mode; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
00002 /* vim: set ai sw=2 ts=2 et cindent cino={1s: */
00003 /*
00004  * Host Identity Protocol
00005  * Copyright (c) 2011-2012 the Boeing Company
00006  * 
00007  * Permission is hereby granted, free of charge, to any person obtaining a copy
00008  * of this software and associated documentation files (the "Software"), to deal
00009  * in the Software without restriction, including without limitation the rights
00010  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011  * copies of the Software, and to permit persons to whom the Software is
00012  * furnished to do so, subject to the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice shall be included in
00015  * all copies or substantial portions of the Software.
00016  * 
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00023  * THE SOFTWARE.
00024  *
00025  *  \file  ifmap_client.h
00026  *
00027  *  \authors    David Mattes, <david.mattes@boeing.com>
00028  *
00029  *  \brief  IF-MAP Plug-in for Endbox mode: MAP Client class declaration
00030  *
00031  */
00032 
00033 #ifndef IFMAP_CLIENT_H
00034 #define IFMAP_CLIENT_H
00035 
00036 #include <QtCore>
00037 #include "ifmap1_1.h"
00038 
00039 using namespace ifmap11;
00040 
00041 class IfmapClient : public QObject {
00042   Q_OBJECT
00043 public:
00044   IfmapClient(QObject *parent = 0);
00045   ~IfmapClient();
00046 
00047 public slots:
00048   void connectToMap(QMap<QString,QString> *mapConfig);
00049   void setUnderlayIp(QString ip);
00050 
00051 private slots:
00052   void newSession();
00053   void mapResponseOnARC(MapResponse *mapResponse);
00054   void publishUnderlayIp();
00055 
00056 private:
00057   void updateEndboxMapping(SearchResult *searchResult);
00058   QString interfaceAddr();
00059   bool purgePublisher();
00060   bool publishCurrentState();
00061   bool setupEndboxMapSubscriptions();
00062   bool searchCurrentConfig();
00063   void processPollResponse(MapResponse *mapResponse);
00064 
00065 private:
00066   Ifmap *_ifmap;
00067   bool _haveValidSession;
00068   QString _sessionId;
00069   QString _publisherId;
00070   QString _currentIp;
00071   QString _oldIp;
00072   bool _haveInitialConfig;
00073 
00074   QString _scadaNS;
00075 
00076   QString _matchLinks;
00077   QString _resultsFilter;
00078   int _maxDepth;
00079 
00080   int _retryDelay;
00081 
00082   QMap<QString,QString> _mapConfig;
00083 };
00084 
00085 #endif