Class Poco::MongoDB::MessageHeader
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::MongoDB

# class MessageHeader

Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/MessageHeader.h

## Description

Represents the header which is always prepended to a request or response of MongoDB

## Member Summary

Member Functions: getMessageLength, getRequestID, opCode, read, responseTo, setRequestID, write

## Types

### Reply

typedef enum { Reply = 1, Msg = 1000, Update = 2001, Insert = 2002, Query = 2004, GetMore = 2005, Delete = 2006, KillCursors = 2007 } OpCode;

## Constructors

## Destructor

### ~MessageHeader

virtual ~MessageHeader();

Destructor

## Member Functions

### getMessageLength

Int32 getMessageLength() const;

Returns the message length

### getRequestID

Int32 getRequestID() const;

Returns the request id of the current message

### opCode

OpCode opCode() const;

Returns the OpCode

### read

void read(
BinaryReader & reader
);

Reads the header

### responseTo

Int32 responseTo() const;

Returns the request id from the original request.

### setRequestID

void setRequestID(
Int32 id
);

Sets the request id of the current message

### write

void write(
BinaryWriter & writer
);

Writes the header

## Variables

### MSG_HEADER_SIZE

static const unsigned int MSG_HEADER_SIZE = 16;