4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author João Luis M. Assirati
11 * Full author contact details are available in file CREDITS.
17 #include "support/socktools.h"
23 class LyXServerSocket;
26 /** Sockets can be in two states: listening and connected.
27 * Connected sockets are used to transfer data, and will therefore
28 * be called Data Sockets. Listening sockets are used to create
29 * Data Sockets when clients connect, and therefore will be called
32 * This class encapsulates local (unix) server socket operations and
33 * manages LyXDataSockets objects that are created when clients connect.
38 LyXServerSocket(LyXFunc *, std::string const &);
40 /// File descriptor of the socket
42 /// Address of the local socket
43 std::string const & address() const;
44 /// To be called when there is activity in the server socket
45 void serverCallback();
46 /// To be called when there is activity in the data socket
47 void dataCallback(LyXDataSocket *);
50 /// Close the connection to the argument client
51 void close(LyXDataSocket *);
54 /// File descriptor for the server socket
56 /// Stores the socket filename
58 /// Maximum number of simultaneous clients
63 std::set<LyXDataSocket *> clients;
67 /** This class encapsulates data socket operations.
68 * It provides read and write IO operations on the socket.
73 LyXDataSocket(LyXServerSocket *);
75 /// The object that allocated us
76 LyXServerSocket * server() const;
77 /// File descriptor of the connection
80 bool connected() const;
81 /// Line buffered input from the socket
82 bool readln(std::string &);
83 /// Write the string + '\n' to the socket
84 void writeln(std::string const &);
87 LyXServerSocket * server_;
88 /// File descriptor for the data socket
90 /// True if the connection is up
92 /// buffer for input data