Beispiel #1
0
// Read bytes from the already opened SSH connection
int
SSHClient::sshRead(cygnal::Buffer &buf)
{
    GNASH_REPORT_FUNCTION;

    return sshRead(buf.reference(), buf.size());
}
Beispiel #2
0
DiskStream::DiskStream(const string &str, cygnal::Buffer &buf)
    : _state(DiskStream::NO_STATE),
      _filefd(0),
      _netfd(0),
      _dataptr(0),
      _max_memload(0),
      _pagesize(0),
      _offset(0)
{
//    GNASH_REPORT_FUNCTION;
    
    /// \brief get the pagesize and cache the value
#ifdef HAVE_SYSCONF
    _pagesize = sysconf(_SC_PAGESIZE);
    _max_memload = _pagesize * MAX_PAGES;    
#else
#ifdef _WIN32
    SYSTEM_INFO si;
    GetSystemInfo(&si);
    _pagesize = si.dwPageSize;
#else
#ifdef __amigaos4__
    uint32 PageSize;
    
    IExec->GetCPUInfoTags(
	GCIT_ExecPageSize, &PageSize, 
	TAG_DONE);
    _pagesize = PageSize;
#else
#error "Need to define the memory page size without sysconf()!"
#endif
#endif
#endif

    _dataptr = new boost::uint8_t[buf.size()];
    // Note that this is a copy operation, which may effect performance. We do this for now
    // incase the top level pointer gets deleted. This should really be using
    // boost::scoped_array, but we don't want that complexity till this code stabalizes.
    std::copy(buf.begin(), buf.end(), _dataptr);
    _filespec = str;
    _filesize = buf.size();
    
#ifdef USE_STATS_CACHE
    clock_gettime (CLOCK_REALTIME, &_last_access);
    _accesses = 1;
#endif
}
Beispiel #3
0
int 
SSHClient::writeChannel(ssh_channel channel, cygnal::Buffer &buf)
{
//    GNASH_REPORT_FUNCTION;
    int ret = -1;

    if (channel) {
	ret = channel_write(channel, buf.reference(), buf.size());
    } else {
	log_error(_("Can't write to a non-existent channel!"));
    }

    return ret;
}