1 20 21 package org.snmp4j.security; 22 23 import java.io.Serializable ; 24 import org.snmp4j.smi.OctetString; 25 26 33 public class UsmTimeEntry implements Serializable { 34 35 private static final long serialVersionUID = -8064483016765127449L; 36 37 private OctetString engineID; 38 private int engineBoots; 39 private int timeDiff; 40 private int latestReceivedTime; 41 42 43 53 public UsmTimeEntry(OctetString engineID, int engineBoots, int engineTime) { 54 this.engineID = engineID; 55 this.engineBoots = engineBoots; 56 setEngineTime(engineTime); 57 } 58 59 public OctetString getEngineID() { 60 return engineID; 61 } 62 63 public int getEngineBoots() { 64 return engineBoots; 65 } 66 67 public void setEngineBoots(int engineBoots) { 68 this.engineBoots = engineBoots; 69 } 70 71 public int getTimeDiff() { 72 return timeDiff; 73 } 74 75 public void setTimeDiff(int timeDiff) { 76 this.timeDiff = timeDiff; 77 } 78 79 85 public int getLatestReceivedTime() { 86 return latestReceivedTime; 87 } 88 89 95 public void setLatestReceivedTime(int latestReceivedTime) { 96 this.latestReceivedTime = latestReceivedTime; 97 } 98 99 105 public void setEngineTime(int engineTime) { 106 this.latestReceivedTime = engineTime; 107 this.timeDiff = engineTime - (int)(System.currentTimeMillis()/1000); 108 } 109 } 110 | Popular Tags |