Switch to unified view

a/src/netcon.h b/src/netcon.h
...
...
24
24
25
#include <sys/time.h>
25
#include <sys/time.h>
26
#include <map>
26
#include <map>
27
#include <string>
27
#include <string>
28
28
29
#include MEMORY_INCLUDE
29
#include <memory>
30
30
31
/// A set of classes to manage client-server communication over a
31
/// A set of classes to manage client-server communication over a
32
/// connection-oriented network, or a pipe.
32
/// connection-oriented network, or a pipe.
33
///
33
///
34
/// The listening/connection-accepting code currently only uses
34
/// The listening/connection-accepting code currently only uses
...
...
41
/// timeout-protected/asynchronous io using a given fd (ie a pipe
41
/// timeout-protected/asynchronous io using a given fd (ie a pipe
42
/// descriptor)
42
/// descriptor)
43
43
44
/// Base class for all network endpoints:
44
/// Base class for all network endpoints:
45
class Netcon;
45
class Netcon;
46
typedef STD_SHARED_PTR<Netcon> NetconP;
46
typedef std::shared_ptr<Netcon> NetconP;
47
class SelectLoop;
47
class SelectLoop;
48
48
49
class Netcon {
49
class Netcon {
50
public:
50
public:
51
    enum Event {NETCONPOLL_READ = 0x1, NETCONPOLL_WRITE = 0x2};
51
    enum Event {NETCONPOLL_READ = 0x1, NETCONPOLL_WRITE = 0x2};
...
...
244
    /// Read a line of text on an ascii connection. Returns -1 or byte count
244
    /// Read a line of text on an ascii connection. Returns -1 or byte count
245
    /// including final 0. \n is kept
245
    /// including final 0. \n is kept
246
    virtual int getline(char *buf, int cnt, int timeo = -1);
246
    virtual int getline(char *buf, int cnt, int timeo = -1);
247
    /// Set handler to be called when the connection is placed in the
247
    /// Set handler to be called when the connection is placed in the
248
    /// selectloop and an event occurs.
248
    /// selectloop and an event occurs.
249
    virtual void setcallback(STD_SHARED_PTR<NetconWorker> user) {
249
    virtual void setcallback(std::shared_ptr<NetconWorker> user) {
250
        m_user = user;
250
        m_user = user;
251
    }
251
    }
252
252
253
private:
253
private:
254
    char *m_buf;    // Buffer. Only used when doing getline()s
254
    char *m_buf;    // Buffer. Only used when doing getline()s
255
    char *m_bufbase;    // Pointer to current 1st byte of useful data
255
    char *m_bufbase;    // Pointer to current 1st byte of useful data
256
    int m_bufbytes; // Bytes of data.
256
    int m_bufbytes; // Bytes of data.
257
    int m_bufsize;  // Total buffer size
257
    int m_bufsize;  // Total buffer size
258
    STD_SHARED_PTR<NetconWorker> m_user;
258
    std::shared_ptr<NetconWorker> m_user;
259
    virtual int cando(Netcon::Event reason); // Selectloop slot
259
    virtual int cando(Netcon::Event reason); // Selectloop slot
260
};
260
};
261
261
262
/// Network endpoint, client side.
262
/// Network endpoint, client side.
263
class NetconCli : public NetconData {
263
class NetconCli : public NetconData {