MDSip plugins: Detailed description of MDSip plugins - MdsWiki
Personal tools

From MdsWiki

Jump to: navigation, search

MDSip Plugin Description

The MDSip protocol now supports the addition of plugins for the transport layer of the MDSip communications. There are two types of plugins available, communication shared libraries and communication applications.

Communication Shared Libraries

When you specify a communication protocol in your url-like connection string, MDSip will attempt to load a shared library with the name MdsIp"protocol-name-in-caps", (i.e. on linux or MdsIpTCP.dll on Windows). This library must have an entry point called IO which, when called, returns an IoRoutines structure which contains the addresses of some basic functions needed by MDSip to utilize the transport such as connect, send, recv etc.

MDSip Communication Shared Library Details

When MDSip then needs to connect to the remote server, send messages, receive messages etc. it will call the protocol specific functions to perform those tasks. The protocol routines handle only the communication portion of the client/server exchange. All the message creation and interpretation is handled by the main MDSip code and is common to all communication protocols.

Communication Applications

MDSip provides a mechanism for having MDSip messages to be sent through "communication applications". What this means it that if configured properly, MDSip can run an application or script as subprocess and send outgoing messages to the stdin (input stream) of the subprocess and then read from the stdout (output stream of that subprocess). On the server side the mdsip server process can be run in a mode which will read messages from its stdin and write its responses to its stdout. This is accomplished using a special protocol shared library called MdsIpTunnel. To configure a communication application protocol, you simply copy or create a symbolic link with the name, MdsIp"protocol-name-in-caps", such that the MdsIpTunnel library is loaded. The communication routines in that special library does all the work needed to run the communication application. When the connection routine is called, the tunnel protocol will run a subprocess which executes the command: mdsip-client-"protocol-name-in-lower" passing the connection string (after the protocol portion) as the first argument and mdsip-server-"protocol-name-in-lower" as the second argument. This application or script must set up a connection between the client and the server and relay messages back and forth through its stdin and stdout.

Let's look at the ssh protocol implementation which uses this mechanism. To implement this, we only need to create a symbolic link,, which points to and then create two scripts called, mdsip-client-ssh and mdsip-server-ssh. Let's look at these two scripts (linux versions):


exec ssh $1 "/bin/sh -c '. /etc/profile; $2'"


exec mdsip -P ssh 2>> ~/mdsip-ssh.log

That's all there is to it!!!! The tunnel mechanism simply runs the client script, which in this case connects to the remote host using ssh, and then communicates using stdin and stdout with the remote process. Using this same mechanism we hope to add other protocol options using other communication tools which provide functionality such as secure authentication and authorization and parallel streams for high bandwidth data transfers.

Similarly the http plugin was developed using this tunnel protocol. The mdsip-client-http script is a python script that makes an http connection to an MDSplus wsgi application on the web server. The client script sends mdsip messages via http requests to the mdsip method of the wsgi on the server which in turn passes the messages to MDSplus and then returns the responses back to the client via http responses.

The MDSplus wsgi module is part of the MDSplus python module available as part of the MDSplus installation. You will need to configure your Apache web server to use the MDSplus.wsgi module to enable http access to MDSplus data.