DebugServer2
Loading...
Searching...
No Matches
HandleChannel.h
1// Copyright 2022 Saleem Abdulrasool <compnerd@compnerd.org>
2
3#pragma once
4
5#include "DebugServer2/Host/Channel.h"
6
7namespace ds2 {
8namespace Host {
9
10class HandleChannel : public Channel {
11 int fd_;
12
13public:
14 HandleChannel() : fd_(-1) {}
15 HandleChannel(int fd);
16 ~HandleChannel() override;
17
18 HandleChannel(const HandleChannel &) = delete;
19 HandleChannel(HandleChannel &&other) : fd_(other.fd_) {
20 other.fd_ = -1;
21 }
22
23public:
24 void close() override;
25
26public:
27 bool connected() const override { return fd_ >= 0; }
28
29public:
30 bool wait(int ms = -1) override;
31
32public:
33 ssize_t send(void const *buffer, size_t length) override;
34 ssize_t receive(void *buffer, size_t length) override;
35};
36
37}
38}
Definition Channel.h:18
Definition HandleChannel.h:10