void writeZStream(TAThread thread, z_stream* strm) { if(strm==NULL) { writeString(thread, "NULL"); return; } writeString(thread, "NON_NULL"); writeULong(thread, strm->adler); writeUInt(thread, strm->avail_in); writeUInt(thread, strm->avail_out); writeInt(thread, strm->data_type); writeString(thread, strm->msg); writePointer(thread, strm->state); ta_debug_printf("strm->state==%d\n", strm->state); writePointer(thread, strm->zalloc); writePointer(thread, strm->zfree); writePointer(thread, strm->opaque); writePointer(thread, strm->next_in); writePointer(thread, strm->next_out); writeULong(thread, strm->reserved); writeULong(thread, strm->total_in); writeULong(thread, strm->total_out); }
void writeULongList(TAThread thread, const uLongf* res, int size) { int i; for(i=0;i<size;i++) writeULong(thread, res[i]); }
static TACommandVerdict crc32_cmd(TAThread thread,TAInputStream stream) { uLong crc, res; uInt len; Bytef* buf; // Prepare crc = readULong(&stream); buf = readPointer(&stream); len = readUInt(&stream); START_TARGET_OPERATION(thread); res = crc32(crc, buf, len); END_TARGET_OPERATION(thread); if(buf==0) ta_debug_printf("res==%u\n", res); // Response writeULong(thread, res); sendResponse(thread); return taDefaultVerdict; }
static TACommandVerdict compress2_cmd(TAThread thread,TAInputStream stream) { Bytef * dest, *source; uLongf destLen, sourceLen; int res, level; dest = readPointer(&stream); destLen = readULong(&stream); source = readPointer(&stream); sourceLen = readULong(&stream); level = readInt(&stream); ta_debug_printf("level==%d\n", level); ta_debug_printf("source==%s\n", source); START_TARGET_OPERATION(thread); if(level==-1) res = compress2(dest, &destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); else res = compress2(dest, &destLen, source, sourceLen, level); END_TARGET_OPERATION(thread); ta_debug_printf("dest==%s\n", dest); writePointer(thread, dest); writeULong(thread, destLen); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }
static TACommandVerdict compress_cmd(TAThread thread,TAInputStream stream) { Bytef * dest, *source; uLongf destLen, sourceLen; int res; dest = readPointer(&stream); destLen = readULong(&stream); source = readPointer(&stream); sourceLen=readULong(&stream); START_TARGET_OPERATION(thread); res = compress(dest, &destLen, source, sourceLen); END_TARGET_OPERATION(thread); writePointer(thread, dest); writeULong(thread, destLen); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }
static TACommandVerdict adler32_cmd(TAThread thread,TAInputStream stream) { char* buf; uLong adler, res; uInt len; size_t size; int bufIsNull; // Prepare adler = readULong(&stream); readByteArray(&stream, &buf, &size); len = readUInt(&stream); bufIsNull = readInt(&stream); START_TARGET_OPERATION(thread); if(!bufIsNull) res = adler32(adler, (Bytef*)buf, len); else res = adler32(adler, Z_NULL, len); END_TARGET_OPERATION(thread); // Response writeULong(thread, res); sendResponse(thread); return taDefaultVerdict; }
void writeFileStatus(TAThread thread, struct stat* buffer) { writeULLong(thread, buffer->st_dev); writeULong(thread, buffer->st_ino); //Encoding st_mode if(S_ISBLK(buffer->st_mode)) writeInt(thread, 1); else if(S_ISCHR(buffer->st_mode)) writeInt(thread, 2); else if(S_ISFIFO(buffer->st_mode)) writeInt(thread, 3); else if(S_ISREG(buffer->st_mode)) writeInt(thread, 4); else if(S_ISDIR(buffer->st_mode)) writeInt(thread, 5); else if(S_ISLNK(buffer->st_mode)) writeInt(thread, 6); else if(S_ISSOCK(buffer->st_mode)) writeInt(thread, 7); else if(S_TYPEISMQ(buffer)) writeInt(thread, 8); else if(S_TYPEISSEM(buffer)) writeInt(thread, 9); else if(S_TYPEISSHM(buffer)) writeInt(thread, 10); #ifdef S_TYPEISTMO else if(S_TYPEISTMO(buffer)) writeInt(thread, 11); #endif else writeInt(thread, 0); //Encoding S_IRWXU if(buffer->st_mode & S_IRUSR) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IWUSR) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IXUSR) writeInt(thread, 1); else writeInt(thread, 0); //Encoding S_IRWXG if(buffer->st_mode & S_IRGRP) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IWGRP) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IXGRP) writeInt(thread, 1); else writeInt(thread, 0); //Encoding S_IRWXO if(buffer->st_mode & S_IROTH) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IWOTH) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_IXOTH) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_ISUID) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_ISGID) writeInt(thread, 1); else writeInt(thread, 0); if(buffer->st_mode & S_ISVTX) writeInt(thread, 1); else writeInt(thread, 0); //End of encoding st_mode writeULong(thread, buffer->st_nlink); writeUInt(thread, buffer->st_uid); writeUInt(thread, buffer->st_gid); writeULLong(thread, buffer->st_rdev); writeLLong(thread, buffer->st_size); writeLong(thread, buffer->st_atime); writeLong(thread, buffer->st_mtime); writeLong(thread, buffer->st_ctime); writeLLong(thread, buffer->st_blksize); writeLLong(thread, buffer->st_blocks); }
void MessageEncoder::writeMap(const qpid::types::Variant::Map& properties, const Descriptor* d, bool large) { void* token = large ? startMap32(d) : startMap8(d); for (qpid::types::Variant::Map::const_iterator i = properties.begin(); i != properties.end(); ++i) { writeString(i->first); switch (i->second.getType()) { case qpid::types::VAR_MAP: case qpid::types::VAR_LIST: //not allowed (TODO: revise, only strictly true for application-properties) whereas this is now a more general method) QPID_LOG(warning, "Ignoring nested map/list; not allowed in application-properties for AMQP 1.0"); case qpid::types::VAR_VOID: writeNull(); break; case qpid::types::VAR_BOOL: writeBoolean(i->second); break; case qpid::types::VAR_UINT8: writeUByte(i->second); break; case qpid::types::VAR_UINT16: writeUShort(i->second); break; case qpid::types::VAR_UINT32: writeUInt(i->second); break; case qpid::types::VAR_UINT64: writeULong(i->second); break; case qpid::types::VAR_INT8: writeByte(i->second); break; case qpid::types::VAR_INT16: writeShort(i->second); break; case qpid::types::VAR_INT32: writeInt(i->second); break; case qpid::types::VAR_INT64: writeULong(i->second); break; case qpid::types::VAR_FLOAT: writeFloat(i->second); break; case qpid::types::VAR_DOUBLE: writeDouble(i->second); break; case qpid::types::VAR_STRING: if (i->second.getEncoding() == BINARY) { writeBinary(i->second); } else { writeString(i->second); } break; case qpid::types::VAR_UUID: writeUuid(i->second); break; } } if (large) endMap32(properties.size()*2, token); else endMap8(properties.size()*2, token); }