Communication Strategies Plugin (CS)

From MARIEWiki

Jump to: navigation, search

pregnancy and stages of development alyson hannigan home movies site operations plan sand filter stuttering interventions life and death movie moving companies nyc naturist youth trail horse arlington va police station snowfire movie angelina naked free sprint sanyo ringtones atlanta black crackers players movie theater steamboat springs movie title graphics albuterol side effects children pirate play tent www download windows 98 court record search domain ludlum movie apple movie previews gallview home main music score for brick house easy video joiner cracked junior lefthanded golf clubs nero video express lead screw applications mezuzahs thoroughbred racing horse naruto movies download staghorn fern samsung clp500 colour laser review burglar alarm springfield missouri lorry definition stardust hotel las vegas jvc videocameras paul butler boats submerged movie lease film equipment tantric love pictures from movie kill bill vol. 1 area bay car classifieds pornstar finder.net free ringtone z500a acrylic awards bronze animal statue home fashion jewelry wholesale gallon of cum home realvideo to mpeg convert coluzzle automobile loan salvage title erotica kissing sapphic video sevendust videos wa football forum airline tickets non stop special education quality sealy mattresses new zealand jobs insulation fittings oregon electrician license hollister co clothing movie cursed official website mach 1 mustang video tremec transmissions lod no cd fix pinnacle video edit software study abroad program ponchos alternative instructions minimum tax girls skimpy werd geboren in url quarkxpress 6.1 activation crack viva las vegas car show theydon bois estate agents sites red light district video.com http map pdp-614mx entertainment system linux motion detection video plugin vrml nutcracker market houston website make flash web sites woman celeb pic reading rainbow video maps of alaska abdelbasset abdelsamad video mother and daughter nude pharmacy naples florida

Contents

What's a Communication Strategy (CS)?

CS are components that are responsible to implements and handles communication protocols.


CS.jpg


CS are mainly use to customize Ports communication protocol handling depending on the communication or application requirements.

Communication Interfaces

Each CS implements the following interfaces :

CommReceiverIF

bool recvData(const char* data, const unsigned int length)
bool recvData(const DataAbstract& data)
bool recvPullSignal()
bool recvPeekSignal()
CommSenderIF

bool sendData(const char* data, const unsigned int length)
bool sendData(const DataAbstract& data)
bool sendPullSignal()
bool sendPeekSignal()


Each CS must define how it supports those interfaces and how it can be used. Normally CS are used in Ports where they generally interacts with one particular protocol implementations (such as Socket, SharedMem, etc.). In this case, receiving data from that protocol is normally forwarded to the CommReceiverIF or CommSenderIF of the next component (depending of the data flow), and when functions are called from CommReceiverIF or CommSenderIF interfaces of the CS, they are forwarded to the supported protocol.


Note: Interfaces will be enhanced in the future to support communication events such as connection, deconnection, buffer overflow, etc.

Dynamic Loading

CS's instances are created by a factory object called CommStrategyFactory. Each CS must be able to produce instances of itself and register itself to the factory as a CS producer. This process is achieve using dynamic loading and it's executed when the factory is first instanciated. Each CS must then follow some rules to be loaded and used correcly:

  • Each CS must be linked in an independant shared object (.so) named with the prefix "libmariecs_"
  • Each directory containing CS shared object to be loaded must be included in an environment variable called "MARIE_CS_PATH" (except for MARIE installation lib directory which is included automatically).
  • Each CS must instanciates a static variable named "TYPE" which contains a unique ID name.
  • Each CS must implements the following creation/deletion functions :
extern "C" 
{
   CommStrategyAbstract* create(ConfigElementType& config);
   void destroy(CommStrategyAbstract* cs)
}
  • Each CS must registers itself to the factory as a CS producer by implementing and instanciating a static proxy class like this :
extern "C" 
{
   class proxy 
   { 
      public:
         proxy()
         {
            (CommStrategyFactory::getInstance()).registerCommStrategy(CS_X::TYPE,
                                                     CommStrategyFactory::CommStrategyFuncMap(create, destroy));
         }
   };
    
   // our one instance of the proxy
   proxy p;
}

Notes on CS creation and deletion

  • At creation, each CS is responsable to parse and validate the configuration object
  • CS instances cannot be deleted directly once created (using delete on the instance name). A call to CSFactory's deleteInstance() function must be used instead.

How to know which CS are available

In MARIE 0.5, you can compile and use the utilitary program marie-info to know which CS are available.

Configuration

Each CS have its own configuration requirements. Please refer to each CS documentation for details.


Personal tools