1212 * Descriptions of ASAP protocol data units and some constants
1313 */
1414public interface ASAP_1_0 {
15- byte OFFER_CMD = 'O' ;
16- byte INTEREST_CMD = 'I' ;
17- byte ASSIMILATE_CMD = 'A' ;
18- String ANY_FORMAT = "any_asap" ;
15+ int CMD_MASK = 0x6 ; // 0110
16+ byte OFFER_CMD = 0 ;
17+ byte INTEREST_CMD = 2 ;
18+ byte ASSIMILATE_CMD = 4 ;
19+
20+ int ENCRYPTED_MASK = 0x1 ; // 0001
21+ byte ENCRYPTED_CMD = 1 ;
22+ String ANY_FORMAT = "ASAP_ANY_FORMAT" ;
1923 String ASAP_MANAGEMENT_FORMAT = "asap/control" ;
2024 int ERA_NOT_DEFINED = -1 ;
2125
@@ -38,15 +42,15 @@ void offer(CharSequence peer, CharSequence format, CharSequence channel, int era
3842 throws IOException , ASAPException ;
3943
4044 /**
41- * @param peer identifies a peer - can be null
45+ * @param recipient identifies a peer - can be null
4246 * @param channel describes a channel (can be null)
4347 * @param format describes format - used to describe an application that can deal with transmitted data format.
4448 * @param os stream that PDU is to be sent
4549 * @param signed message is signed
4650 * @throws IOException exception during writing on stream
4751 * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
4852 */
49- void offer (CharSequence peer , CharSequence format , CharSequence channel , OutputStream os , boolean signed )
53+ void offer (CharSequence recipient , CharSequence format , CharSequence channel , OutputStream os , boolean signed )
5054 throws IOException , ASAPException ;
5155
5256 /*
@@ -55,8 +59,8 @@ void offer(CharSequence peer, CharSequence format, CharSequence channel, OutputS
5559 */
5660
5761 /**
58- * @param peer identifies a peer - can be null
59- * @param sourcePeer wished source (authority) of information (optional, can be null)
62+ * @param sender identifies sender - can be null
63+ * @param recipient can be null - no restriction - any encountered peer will get it.
6064 * @param eraFrom lower limit of era range (-1 means undefined)
6165 * @param eraTo upper limit of era range (-1 means undefined)
6266 * @param channel whished / required channel (can be null)
@@ -66,13 +70,26 @@ void offer(CharSequence peer, CharSequence format, CharSequence channel, OutputS
6670 * @throws IOException exception during writing on stream
6771 * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
6872 */
69- void interest (CharSequence peer , CharSequence sourcePeer , CharSequence format ,
73+ void interest (CharSequence sender , CharSequence recipient , CharSequence format ,
7074 CharSequence channel , int eraFrom , int eraTo ,
7175 OutputStream os , boolean signed ) throws IOException , ASAPException ;
7276
77+
7378 /**
74- * @param peer identifies a peer - can be null
75- * @param sourcePeer wished source (authority) of information (optional, can be null)
79+ * @param sender identifies sender - can be null
80+ * @param recipient can be null - no restriction - any encountered peer will get it.
81+ * @param channel whished / required channel (can be null)
82+ * @param format describes format - used to describe an application that can deal with transmitted data format.
83+ * @param os stream that PDU is to be sent
84+ * @throws IOException exception during writing on stream
85+ * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
86+ */
87+ void interest (CharSequence sender , CharSequence recipient , CharSequence format ,
88+ CharSequence channel , OutputStream os ) throws IOException , ASAPException ;
89+
90+ /**
91+ * @param sender identifies sender - can be null
92+ * @param recipient can be null - no restriction - any encountered peer will get it.
7693 * @param eraFrom lower limit of era range (-1 means undefined)
7794 * @param eraTo upper limit of era range (-1 means undefined)
7895 * @param channel whished / required channel (can be null)
@@ -85,22 +102,23 @@ void interest(CharSequence peer, CharSequence sourcePeer, CharSequence format,
85102 * @throws IOException
86103 * @throws ASAPException
87104 */
88- void interest (CharSequence peer , CharSequence sourcePeer , CharSequence format ,
105+ void interest (CharSequence sender , CharSequence recipient , CharSequence format ,
89106 CharSequence channel , int eraFrom , int eraTo ,
90107 OutputStream os , boolean sign , boolean encrypted , boolean mustBeEncrypted )
91108 throws IOException , ASAPException , ASAPSecurityException ;
92109
93110 /**
94- * @param peer wished source (authority) of information
111+ * @param sender identifies sender - can be null
95112 * @param channel whished / required channel (can be null)
96113 * @param format describes format - used to describe an application that can deal with transmitted data format.
97114 * @param os stream that PDU is to be sent
98115 * @param signed message is signed
99116 * @throws IOException exception during writing on stream
100117 * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
101118 */
102- void interest (CharSequence peer , CharSequence format , CharSequence sourcePeer , CharSequence channel ,
103- OutputStream os , boolean signed ) throws IOException , ASAPException ;
119+ void interest (CharSequence sender , CharSequence format , CharSequence sourcePeer ,
120+ CharSequence channel , OutputStream os , boolean signed , boolean encrypted ,
121+ boolean mustBeEncrypted ) throws IOException , ASAPException ;
104122
105123 /*
106124 ASSIMILATE: Peer (optional) issues data (mandatory) to a channel (mandatory) in a format (mandatory) of a
@@ -109,8 +127,8 @@ void interest(CharSequence peer, CharSequence format, CharSequence sourcePeer, C
109127
110128 /**
111129 *
112- * @param peer sender (optional, can be null)
113- * @param recipientPeer wished recipient (optional, can be null)
130+ * @param sender sender (optional, can be null)
131+ * @param recipient wished recipient (optional, can be null)
114132 * @param channelUri mandatory
115133 * @param format mandatory
116134 * @param offsets applications will probably store a number of messages in a data block. This (optional) list
@@ -121,14 +139,14 @@ void interest(CharSequence peer, CharSequence format, CharSequence sourcePeer, C
121139 * @throws IOException exception during writing on stream
122140 * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
123141 */
124- void assimilate (CharSequence peer , CharSequence recipientPeer , CharSequence format , CharSequence channelUri , int era ,
142+ void assimilate (CharSequence sender , CharSequence recipient , CharSequence format , CharSequence channelUri , int era ,
125143 long length , List <Long > offsets , InputStream dataIS , OutputStream os , boolean signed )
126144 throws IOException , ASAPException ;
127145
128146 /**
129147 *
130- * @param peer sender (optional, can be null)
131- * @param recipientPeer wished recipient (optional, can be null)
148+ * @param sender sender (optional, can be null)
149+ * @param recipient wished recipient (optional, can be null)
132150 * @param channel mandatory
133151 * @param format mandatory
134152 * @param offsets applications will probably store a number of messages in a data block. This (optional) list
@@ -139,7 +157,7 @@ void assimilate(CharSequence peer, CharSequence recipientPeer, CharSequence form
139157 * @throws IOException exception during writing on stream
140158 * @throws ASAPException protocol exception: mandatory parameter missing, invalid combination of parameters, ..
141159 */
142- void assimilate (CharSequence peer , CharSequence recipientPeer , CharSequence format , CharSequence channel , int era ,
160+ void assimilate (CharSequence sender , CharSequence recipient , CharSequence format , CharSequence channel , int era ,
143161 List <Long > offsets , byte [] data , OutputStream os , boolean signed )
144162 throws IOException , ASAPException ;
145163
0 commit comments