wtanaka.praya.gale
Class PuffOperation

java.lang.Object
  |
  +--wtanaka.praya.gale.PuffOperation
All Implemented Interfaces:
OperationInterface
Direct Known Subclasses:
PublicKeyFetchOperation

public class PuffOperation
extends java.lang.Object
implements OperationInterface

PUFF, from Gale Protocol Version 0.

 Opcode 0x00000000: puff (transmit a message)
 +--+--+--+--+--+--+--+--+--+--+--+-||-+--+--+--+--+-
 | cat. len. | message category ... || |00|00|00|00|
 +--+--+--+--+--+--+--+--+--+--+--+-||-+--+--+--+--+-
             |<--- category length --->|
                     (in bytes)

 ...

                          |<------------ length (in bytes) ------------>|
 -+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-||-+--+--+--+-||-+-
  |   type    |  length   | F.N. len. | frag. name ... || | value... || | 
 -+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-||-+--+--+--+-||-+-
                                      |<---- FN len. ---->|
  |                                      (in characters)                |
  |                                                                     |
  |<----------- Repeated; this is called a "fragment list". ----------->|

 

Return to Sourceforge or the Praya Homepage

Version:
$Name: $ $Date: 2001/09/30 21:14:52 $
Author:
$Author: wtanaka $

Field Summary
private  Category[] m_categories
           
protected  FragmentList m_fragments
           
 
Fields inherited from interface wtanaka.praya.gale.OperationInterface
GIMME, PUFF, WILL
 
Constructor Summary
PuffOperation(Category[] category, FragmentList fragList)
           
PuffOperation(Category category, FragmentList fragList)
           
 
Method Summary
 PuffOperation encrypt(GalePublicKey[] targets)
          Encrypts the message for the given recipients.
(package private)  java.lang.String getCategories()
          Returns a colon separated string representing the categories for this puff operation
 Category getCategoryAt(int i)
           
 FragmentList getFragmentList()
           
private  int getFragmentListLength()
           
 int getNumCategories()
           
 int getOpcode()
           
 int getStreamLength()
           
 PuffOperation sign(GalePrivateKey priv)
          Signs the message with the given private key
 java.lang.String toString()
           
 PuffOperation withNewFragment(FragmentInterface fragment)
           
 void write(GaleOutputStream out)
          Writes this puff operation to the given output stream, locking it with synchronized (out).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_categories

private Category[] m_categories

m_fragments

protected FragmentList m_fragments
Constructor Detail

PuffOperation

public PuffOperation(Category[] category,
                     FragmentList fragList)
Parameters:
fragments - the list of fragments to use. Null is interpreted as the empty list.

PuffOperation

public PuffOperation(Category category,
                     FragmentList fragList)
Parameters:
fragments - the list of fragments to use. Null is interpreted as the empty list.
Method Detail

sign

public PuffOperation sign(GalePrivateKey priv)
                   throws java.security.NoSuchAlgorithmException
Signs the message with the given private key
Throws:
java.security.NoSuchAlgorithmException - if we cannot sign because MD5 is not available

encrypt

public PuffOperation encrypt(GalePublicKey[] targets)
Encrypts the message for the given recipients.

withNewFragment

public PuffOperation withNewFragment(FragmentInterface fragment)

getOpcode

public int getOpcode()
Specified by:
getOpcode in interface OperationInterface

getNumCategories

public int getNumCategories()

getCategoryAt

public Category getCategoryAt(int i)

getCategories

java.lang.String getCategories()
Returns a colon separated string representing the categories for this puff operation

getFragmentListLength

private int getFragmentListLength()

getFragmentList

public FragmentList getFragmentList()

getStreamLength

public int getStreamLength()
Specified by:
getStreamLength in interface OperationInterface
Following copied from interface: wtanaka.praya.gale.OperationInterface
Returns:
the total length of the wire representation of this operation, including opcode.

write

public void write(GaleOutputStream out)
           throws java.io.IOException
Writes this puff operation to the given output stream, locking it with synchronized (out).
Specified by:
write in interface OperationInterface
Parameters:
out - the stream on which to write

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object