summaryrefslogtreecommitdiff
path: root/src/org/noreply/fancydress/type3/routing/RoutingDestination.java
blob: 500ebc5b1d0b1938b8c8c0b8e6fd3ff32319a95c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* $Id$ */
package org.noreply.fancydress.type3.routing;

/**
 * Base class for all Routings that are final destinations.
 *
 * Routings of this type usually mean that the message leaves the Type III
 * network at the server processing them (for instance to be delivered via
 * SMTP).  In case of a DROP type it means that the packet is dropped at this
 * node.
 */
public abstract class RoutingDestination extends Routing {
	/**
	 * The size of decoding handles for payloads
	 */
	public static final int DECODINGHANDLE_LEN = 20;

	/**
	 * A decoding handle as is used in SURBS or forward encrypted messages.
	 */
	protected byte[] decodingHandle;

	/**
	 * Default constructor.
	 *
	 *  @param type The routing type as integer.
	 */
	protected RoutingDestination(int type) {
		super (type);
		decodingHandle = null;
	}

	/**
	 * Set a decoding handle as is used in SURBS or forward encrypted messages.
	 *
	 * @param decodingHandle decoding handle
	 */
	public void setDecodingHandle(byte[] decodingHandle) {
		if (decodingHandle.length != DECODINGHANDLE_LEN)
			throw new Error("Decoding handle is not DECODINGHANDLE_LEN bytes long.");
		this.decodingHandle = decodingHandle;
	}
}