-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRRecord.java
More file actions
87 lines (69 loc) · 2.09 KB
/
Copy pathRRecord.java
File metadata and controls
87 lines (69 loc) · 2.09 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package ca.ubc.cs.cs317.dnslookup;
public class RRecord {
private String nameLookedUp;
private String name;
private String type;
private int ttl;
private int dataLength;
private String nameServer;
private boolean isInetAddress = true;
public void setNameLookedUp(String nameLookedUp){
this.nameLookedUp = nameLookedUp;
}
public void setType(int type){
switch (type){
case 1:
this.type = "A";
break;
case 2:
this.type = "NS";
break;
case 5:
this.type = "CNAME";
break;
case 6:
this.type = "SOA";
break;
case 15:
this.type = "MX";
break;
case 28:
this.type = "AAAA";
break;
default:
this.type = "OTHER";
}
}
public void setTtl(int ttl){
this.ttl = ttl;
}
public void setDataLength(int dataLength){
this.dataLength = dataLength;
}
public void setisInetAddressFalse(){
this.isInetAddress = false;
}
public void setNameServer(String nameServer){
this.nameServer = nameServer;
}
public void setName(String name){this.name = name;}
public void printInfo(){
System.out.format(" %-30s %-10d %-4s %s\n", getName(), getTtl(), getType(), getNameServer());
}
public String getNameLookedUp(){
return nameLookedUp;
}
public String getType(){
return type;
}
public String getName(){return name;}
public boolean getisInetAddress() {
return isInetAddress;
}
public int getTtl(){
return ttl;
}
public String getNameServer(){
return nameServer;
}
}