ACE Tutorial 015
Building a protocol stream


While I might be able to come up with a competitive compressor, I don't have a snowball's chance to code up encryption. I'd be better off piping the data through the standard Unix crypt command.

So, while I was lazy with Compress, I'm realistic with Crypt. I'll show you the hooks and entry points and let someone else contribute an encryptor.


// page20.html,v 1.14 2000/04/09 18:24:25 jcej Exp

#ifndef CRYPT_H
#define CRYPT_h

#include "Protocol_Task.h"

/* An interface (adaptor) between your favorite encryption method and
   an ACE_Stream.
*/
class Crypt : public Protocol_Task
{
public:

  typedef Protocol_Task inherited;

  Crypt (void);

  ~Crypt (void);

protected:

  // Moving downstream will encrypt the data
  int send (ACE_Message_Block *message,
            ACE_Time_Value *timeout);

  // And moving upstream will decrypt it.
  int recv (ACE_Message_Block *message,
            ACE_Time_Value *timeout);
};

#endif /* CRYPT_H */


[Tutorial Index] [Continue This Tutorial]