OpFlex Framework  1.7.0
OFFramework.h
Go to the documentation of this file.
1 /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 
572 #pragma once
573 #ifndef OPFLEX_CORE_OFFRAMEWORK_H
574 #define OPFLEX_CORE_OFFRAMEWORK_H
575 
576 #include <vector>
577 #include <string>
578 
579 #include <boost/noncopyable.hpp>
580 
581 #include "opflex/modb/Mutator.h"
584 
597 namespace opflex {
598 namespace modb {
599 class ObjectStore;
600 class ModelMetadata;
601 namespace mointernal {
602 class MO;
603 }
604 }
605 
606 namespace ofcore {
607 
644 class OFFramework : private boost::noncopyable {
645 public:
649  OFFramework();
650 
654  virtual ~OFFramework();
655 
660  static const std::vector<int>& getVersion();
661 
666  static const std::string& getVersionStr();
667 
671  static OFFramework& defaultInstance();
672 
679  void setModel(const modb::ModelMetadata& model);
680 
689  void setOpflexIdentity(const std::string& name,
690  const std::string& domain);
691 
701  void setOpflexIdentity(const std::string& name,
702  const std::string& domain,
703  const std::string& location);
704 
709  virtual void start();
710 
714  virtual void stop();
715 
726  virtual MainLoopAdaptor* startSync();
727 
734  virtual void dumpMODB(const std::string& file);
735 
742  virtual void dumpMODB(FILE* file);
743 
754  virtual void prettyPrintMODB(std::ostream& output,
755  bool tree = true,
756  bool includeProps = true,
757  bool utf8 = true,
758  size_t truncate = 0);
759 
769  virtual void enableSSL(const std::string& caStorePath,
770  bool verifyPeers = true);
771 
785  virtual void enableSSL(const std::string& caStorePath,
786  const std::string& keyAndCertFilePath,
787  const std::string& passphrase,
788  bool verifyPeers = true);
789 
797  virtual void enableInspector(const std::string& socketName);
798 
815  virtual void addPeer(const std::string& hostname,
816  int port);
817 
825  virtual void registerPeerStatusListener(PeerStatusListener* listener);
826 
827 private:
835  modb::ObjectStore& getStore();
836 
842  void registerTLMutator(modb::Mutator& mutator);
847  modb::Mutator& getTLMutator();
851  void clearTLMutator();
852 
853  class OFFrameworkImpl;
854  OFFrameworkImpl* pimpl;
855 
856  friend class OFFrameworkImpl;
857  friend class modb::Mutator;
858  friend class modb::mointernal::MO;
859  friend class MockOFFramework;
860 };
861 
869 class MockOFFramework : public OFFramework {
870 public:
871  MockOFFramework() : OFFramework() { }
872  virtual ~MockOFFramework() {};
873 
874  virtual void start();
875  virtual void stop();
876 };
877 
887 } /* namespace ofcore */
888 } /* namespace opflex */
889 
890 #endif /* OPFLEX_CORE_OFFRAMEWORK_H */
This is the base class for all managed objects, which are the primary point of interface with data st...
Definition: MO.h:48
A mutator represents a set of changes to apply to the data store.
Definition: Mutator.h:61
Main interface to the OpFlex framework.
Definition: OFFramework.h:644
Interface definition for main loop adaptor.
Definition: OFLogHandler.h:20
An interface for a listener that will get status update events for peer connection state...
Definition: PeerStatusListener.h:30
Model metadata encapsulated all the metadata for a given model.
Definition: ModelMetadata.h:47
An adaptor that allows integrating libopflex with an external main loop.
Definition: MainLoopAdaptor.h:31
A mock framework object that will not attempt to create remote connections or resolve references...
Definition: OFFramework.h:869
Interface definition file for Mutators.
Interface definition for peer status.