The document discusses the composite message pattern, which organizes communication between components by packaging all data into message objects. This simplifies interaction, minimizes communication overhead, and allows components to be easily added or removed with minimal changes. The pattern supports efficient memory management and reflexibility in networked systems.
55. DVMMessage Code Class DVMMessage { /* Network Protocol Header */ //Leave space for Underlying Protocol Header // such as the Ethernet Header; unsigned _underlyingHeaderSize; unsigned _packetSize; //DVM Protocol using local identifiers DVMMessageType _type; unsigned _source; unsigned _destination; unsigned _timestamp; unsigned _checksum; /* Header and Auxiliary Header */ //Page List Header unsigned _totalNumberOfPages; unsigned _thisPageNumber; unsigned _offsetInPages; unsigned _pageFramentSize; } // List of pages to marshal from and unmarshal to. Page * _pageList; Page * _pageBeingProcessed /* Getter and Setter Functions */ //Expose using friend interfaces. … . public: //add pages to the list similar to add() //for the abstract message void addPages (Page * morePages); //marshal to buffer from page void marshal (unsigned *buffer, unsigned bufferSize); //unmarshal from buffer into page void unmarshal (unsigned* buffer, unsigned bufferSize); };
56. Fragmentation Message Code class Fragmenation { public : //calculate proper framents and ask message // to marshal parts of itself into the buffer. void makeFrags ( DVMMessage *m , unsigned * buffer, unsigned * bufferSize);