MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / fromWire

Method fromWire

src/main/java/core/org/xbill/DNS/EDNSOption.java:116–142  ·  view source on GitHub ↗

Converts the wire format of an EDNS Option (including code and length) into the type-specific format. @param out The input stream.

(DNSInput in)

Source from the content-addressed store, hash-verified

114 * @param out The input stream.
115 */
116static EDNSOption
117fromWire(DNSInput in) throws IOException {
118 int code, length;
119
120 code = in.readU16();
121 length = in.readU16();
122 if (in.remaining() < length)
123 throw new WireParseException("truncated option");
124 int save = in.saveActive();
125 in.setActive(length);
126 EDNSOption option;
127 switch (code) {
128 case Code.NSID:
129 option = new NSIDOption();
130 break;
131 case Code.CLIENT_SUBNET:
132 option = new ClientSubnetOption();
133 break;
134 default:
135 option = new GenericEDNSOption(code);
136 break;
137 }
138 option.optionFromWire(in);
139 in.restoreActive(save);
140
141 return option;
142}
143
144/**
145 * Converts the wire format of an EDNS Option (including code and length) into

Callers 1

rrFromWireMethod · 0.95

Calls 6

optionFromWireMethod · 0.95
readU16Method · 0.80
remainingMethod · 0.80
saveActiveMethod · 0.80
setActiveMethod · 0.80
restoreActiveMethod · 0.80

Tested by

no test coverage detected