private long machineid;
private Vector<Entry> entries;
private int livecount;
-
+
Slot(long _seqnum, long _machineid, byte[] _prevhmac, byte[] _hmac) {
seqnum=_seqnum;
machineid=_machineid;
entries=new Vector<Entry>();
livecount=1;
}
-
+
Slot(long _seqnum, byte[] _bytes) {
seqnum=_seqnum;
}
entries.add(e);
livecount++;
}
-
+
Vector<Entry> getEntries() {
return entries;
}
-
+
static Slot decode(byte[] array, Mac mac) {
mac.update(array, HMAC_SIZE, array.length-HMAC_SIZE);
byte[] realmac=mac.doFinal();
long machineid=bb.getLong();
int numentries=bb.getInt();
Slot slot=new Slot(seqnum, machineid, prevhmac, hmac);
-
- for(int i=0;i<numentries;i++) {
+
+ for(int i=0; i<numentries; i++) {
slot.addEntry(Entry.decode(slot, bb));
}
-
+
return slot;
}
byte[] encode(Mac mac) {
byte[] array=new byte[SLOT_SIZE];
ByteBuffer bb=ByteBuffer.wrap(array);
- bb.position(HMAC_SIZE); //Leave space for the HMACs
+ bb.position(HMAC_SIZE); //Leave space for the HMACs
bb.put(prevhmac);
bb.putLong(seqnum);
bb.putLong(machineid);
bb.put(realmac);
return array;
}
-
+
long getSequenceNumber() {
return seqnum;
}
long getMachineID() {
return machineid;
}
-
+
byte[] getBytes() {
return null;
}
void decrementLiveCount() {
livecount--;
}
-
+
boolean isLive() {
return livecount > 0;
}