MessageRecord.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package de.tudarmstadt.informatik.hostage.logging;
  2. import java.io.Serializable;
  3. import android.os.Parcel;
  4. import android.os.Parcelable;
  5. public class MessageRecord implements Parcelable, Serializable{
  6. private static final long serialVersionUID = -5936572995202342935L;
  7. public static enum TYPE {
  8. SEND, RECEIVE
  9. };
  10. // attack
  11. private int id;
  12. private long attack_id;
  13. private long timestamp;
  14. private TYPE type;
  15. private String packet;
  16. public static final Parcelable.Creator<MessageRecord> CREATOR = new Parcelable.Creator<MessageRecord>() {
  17. @Override
  18. public MessageRecord createFromParcel(Parcel source) {
  19. return new MessageRecord(source);
  20. }
  21. @Override
  22. public MessageRecord[] newArray(int size) {
  23. return new MessageRecord[size];
  24. }
  25. };
  26. public MessageRecord() {
  27. }
  28. public MessageRecord(Parcel source) {
  29. this.id = source.readInt();
  30. this.attack_id = source.readLong();
  31. this.timestamp = source.readLong();
  32. this.type = TYPE.valueOf(source.readString());
  33. this.packet = source.readString();
  34. }
  35. @Override
  36. public int describeContents() {
  37. return 0;
  38. }
  39. @Override
  40. public void writeToParcel(Parcel dest, int flags) {
  41. dest.writeInt(id);
  42. dest.writeLong(attack_id);
  43. dest.writeLong(timestamp);
  44. dest.writeString(type.name());
  45. dest.writeString(packet);
  46. }
  47. /**
  48. * @return the id
  49. */
  50. public int getId() {
  51. return id;
  52. }
  53. /**
  54. * @param id the id to set
  55. */
  56. public void setId(int id) {
  57. this.id = id;
  58. }
  59. /**
  60. * @return the attack_id
  61. */
  62. public long getAttack_id() {
  63. return attack_id;
  64. }
  65. /**
  66. * @param attack_id the attack_id to set
  67. */
  68. public void setAttack_id(long attack_id) {
  69. this.attack_id = attack_id;
  70. }
  71. /**
  72. * @return the timestamp
  73. */
  74. public long getTimestamp() {
  75. return timestamp;
  76. }
  77. /**
  78. * @param timestamp the timestamp to set
  79. */
  80. public void setTimestamp(long timestamp) {
  81. this.timestamp = timestamp;
  82. }
  83. /**
  84. * @return the type
  85. */
  86. public TYPE getType() {
  87. return type;
  88. }
  89. /**
  90. * @param type the type to set
  91. */
  92. public void setType(TYPE type) {
  93. this.type = type;
  94. }
  95. /**
  96. * @return the packet
  97. */
  98. public String getPacket() {
  99. return packet;
  100. }
  101. /**
  102. * @param packet the packet to set
  103. */
  104. public void setPacket(String packet) {
  105. this.packet = packet;
  106. }
  107. }