Back to index

texmacs  1.0.7.15
socket_link.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : socket_link.cpp
00004 * DESCRIPTION: TeXmacs links by sockets
00005 * COPYRIGHT  : (C) 2000  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef SOCKET_LINK_H
00013 #define SOCKET_LINK_H
00014 #include "tm_link.hpp"
00015 #include "socket_notifier.hpp"
00016 
00017 /******************************************************************************
00018 * The socket_link class
00019 ******************************************************************************/
00020 
00021 struct socket_link_rep: tm_link_rep {
00022   string host;          // host for the socket
00023   int    port;          // port for the socket
00024   int    type;          // socket type
00025   int    io;            // file descriptor for data going to the child
00026   string outbuf;        // pending output from plugin
00027 
00028   socket_notifier sn;
00029   
00030 public:
00031   socket_link_rep (string host, int port, int type, int fd);
00032   ~socket_link_rep ();
00033 
00034   string  start ();
00035   void    write (string s, int channel);
00036   string& watch (int channel);
00037   string  read (int channel);
00038   void    listen (int msecs);
00039   void    interrupt ();
00040   void    stop ();
00041 
00042   void    feed (int channel);
00043 };
00044 
00045 #endif // SOCKET_LINK_H