OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [libdbg64g/] [services/] [remote/] [tcpclient.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2017 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Remote access to debugger via TCP connection. Client thread.
6
 */
7
 
8
#ifndef __DEBUGGER_TCPCLIENT_H__
9
#define __DEBUGGER_TCPCLIENT_H__
10
 
11
#include <iclass.h>
12
#include <iservice.h>
13
#include "tcpcmd.h"
14
#include "coreservices/ithread.h"
15
#include "coreservices/irawlistener.h"
16
 
17
namespace debugger {
18
 
19
class TcpClient : public IService,
20
                  public IThread,
21
                  public IRawListener {
22
 public:
23
    explicit TcpClient(const char *name);
24
    virtual ~TcpClient();
25
 
26
    /** IService interface */
27
    virtual void postinitService();
28
    virtual void setExtArgument(void *args) {
29
        hsock_ = *reinterpret_cast<socket_def *>(args);
30
    }
31
 
32
    /** IRawListener interface */
33
    virtual void updateData(const char *buf, int buflen);
34
 
35
 protected:
36
    /** IThread interface */
37
    virtual void busyLoop();
38
 
39
 protected:
40
    void processRxString();
41
    int sendTxBuf();
42
    void closeSocket();
43
 
44
 private:
45
    AttributeType isEnable_;
46
    AttributeType timeout_;
47
    socket_def hsock_;
48
    mutex_def mutexTx_;
49
    char rcvbuf[4096];
50
    char cmdbuf_[4096];
51
    int cmdcnt_;
52
    char txbuf_[1<<20];
53
    int txcnt_;
54
 
55
    TcpCommands tcpcmd_;
56
};
57
 
58
DECLARE_CLASS(TcpClient)
59
 
60
}  // namespace debugger
61
 
62
#endif  // __DEBUGGER_TCPCLIENT_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.