Android-cuttlefish cvd tool
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
ShellProtocol Class Reference

#include <shell_protocol.h>

Collaboration diagram for ShellProtocol:
Collaboration graph
[legend]

Public Types

enum  Id : uint8_t {
  kIdStdin = 0 , kIdStdout = 1 , kIdStderr = 2 , kIdExit = 3 ,
  kIdCloseStdin = 4 , kIdWindowSizeChange = 5 , kIdInvalid = 255
}
 

Public Member Functions

 ShellProtocol (borrowed_fd fd)
 
virtual ~ShellProtocol ()
 
const char * data () const
 
char * data ()
 
size_t data_capacity () const
 
bool Read ()
 
int id () const
 
size_t data_length () const
 
bool Write (Id id, size_t length)
 

Private Types

enum  { kBufferSize = MAX_PAYLOAD , kHeaderSize = sizeof(Id) + sizeof(length_t) }
 
typedef uint32_t length_t
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (ShellProtocol)
 

Private Attributes

borrowed_fd fd_
 
char buffer_ [kBufferSize]
 
size_t data_length_ = 0
 
size_t bytes_left_ = 0
 
char * buffer_end_ = buffer_ + sizeof(buffer_)
 

Friends

class ShellProtocolTest
 

Member Typedef Documentation

◆ length_t

typedef uint32_t ShellProtocol::length_t
private

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kBufferSize 
kHeaderSize 

◆ Id

enum ShellProtocol::Id : uint8_t
Enumerator
kIdStdin 
kIdStdout 
kIdStderr 
kIdExit 
kIdCloseStdin 
kIdWindowSizeChange 
kIdInvalid 

Constructor & Destructor Documentation

◆ ShellProtocol()

ShellProtocol::ShellProtocol ( borrowed_fd  fd)
explicit

◆ ~ShellProtocol()

ShellProtocol::~ShellProtocol ( )
virtual

Member Function Documentation

◆ data() [1/2]

char * ShellProtocol::data ( )
inline

◆ data() [2/2]

const char * ShellProtocol::data ( ) const
inline

◆ data_capacity()

size_t ShellProtocol::data_capacity ( ) const
inline

◆ data_length()

size_t ShellProtocol::data_length ( ) const
inline

◆ DISALLOW_COPY_AND_ASSIGN()

ShellProtocol::DISALLOW_COPY_AND_ASSIGN ( ShellProtocol  )
private

◆ id()

int ShellProtocol::id ( ) const
inline

◆ Read()

bool ShellProtocol::Read ( )

◆ Write()

bool ShellProtocol::Write ( Id  id,
size_t  length 
)

Friends And Related Function Documentation

◆ ShellProtocolTest

friend class ShellProtocolTest
friend

Member Data Documentation

◆ buffer_

char ShellProtocol::buffer_[kBufferSize]
private

◆ buffer_end_

char* ShellProtocol::buffer_end_ = buffer_ + sizeof(buffer_)
private

◆ bytes_left_

size_t ShellProtocol::bytes_left_ = 0
private

◆ data_length_

size_t ShellProtocol::data_length_ = 0
private

◆ fd_

borrowed_fd ShellProtocol::fd_
private

The documentation for this class was generated from the following files: