<!-- page20.html,v 1.15 2003/08/19 15:08:26 schmidt Exp --> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Author" CONTENT="James CE Johnson"> <TITLE>ACE Tutorial 015</TITLE> </HEAD> <BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> <CENTER><B><FONT SIZE=+2>ACE Tutorial 015</FONT></B></CENTER> <CENTER><B><FONT SIZE=+2>Building a protocol stream</FONT></B></CENTER> <P> <HR WIDTH="100%"> 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. <P> 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. <HR> <PRE> <font color=red>// page20.html,v 1.15 2003/08/19 15:08:26 schmidt Exp</font> <font color=blue>#ifndef</font> <font color=purple>CRYPT_H</font> <font color=blue>#define</font> <font color=purple>CRYPT_h</font> <font color=blue>#include</font> "<font color=green>Protocol_Task.h</font>" <font color=red>/* An interface (adaptor) between your favorite encryption method and an ACE_Stream. */</font> class Crypt : public Protocol_Task { public: typedef Protocol_Task inherited; Crypt (void); ~Crypt (void); protected: <font color=red>// Moving downstream will encrypt the data</font> int send (ACE_Message_Block *message, ACE_Time_Value *timeout); <font color=red>// And moving upstream will decrypt it.</font> int recv (ACE_Message_Block *message, ACE_Time_Value *timeout); }; <font color=blue>#endif</font> <font color=red>/* CRYPT_H */</font> </PRE> <P><HR WIDTH="100%"> <CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page21.html">Continue This Tutorial</A>]</CENTER>