Author: James CE Johnson

ACE Tutorial 015
Building a protocol stream

This and the next three pages present the protocol objects that provide compression and encryption. If you were hoping to learn the secrets of compression and encryption then I'm going to disappoint you. There are some really good libraries out there that do this stuff though and if anyone wants to integrate one of them into the tutorial I'll be glad to take it!

    // page18.html,v 1.11 1999/04/03 21:56:31 jcej Exp

    #ifndef COMPRESSOR_H
    #define COMPRESSOR_h

    #include "Protocol_Task.h"

    /* A reallly dumb compression object.  (It actually adds 3 bytes to
       every message block.)
    */
    class Compressor : public Protocol_Task
    {
    public:

      typedef Protocol_Task inherited;

      Compressor (void);

      ~Compressor (void);

    protected:

      // This is called when the compressor is on the downstream side.
      // We'll take the message, compress it and move it along to the next
      // module.
      int send (ACE_Message_Block *message,
                ACE_Time_Value *timeout);

      // This one is called on the upstream side.  No surprise: we
      // decompress the data and send it on up the stream.
      int recv (ACE_Message_Block *message,
                ACE_Time_Value *timeout);
    };

    #endif /* COMPRESSOR_H */

[Tutorial Index] [Continue This Tutorial]