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

Method startGenerate

src/main/java/core/org/xbill/DNS/Master.java:189–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189private void
190startGenerate() throws IOException {
191 String s;
192 int n;
193
194 // The first field is of the form start-end[/step]
195 // Regexes would be useful here.
196 s = st.getIdentifier();
197 n = s.indexOf("-");
198 if (n < 0)
199 throw st.exception("Invalid $GENERATE range specifier: " + s);
200 String startstr = s.substring(0, n);
201 String endstr = s.substring(n + 1);
202 String stepstr = null;
203 n = endstr.indexOf("/");
204 if (n >= 0) {
205 stepstr = endstr.substring(n + 1);
206 endstr = endstr.substring(0, n);
207 }
208 long start = parseUInt32(startstr);
209 long end = parseUInt32(endstr);
210 long step;
211 if (stepstr != null)
212 step = parseUInt32(stepstr);
213 else
214 step = 1;
215 if (start < 0 || end < 0 || start > end || step <= 0)
216 throw st.exception("Invalid $GENERATE range specifier: " + s);
217
218 // The next field is the name specification.
219 String nameSpec = st.getIdentifier();
220
221 // Then the ttl/class/type, in the same form as a normal record.
222 // Only some types are supported.
223 parseTTLClassAndType();
224 if (!Generator.supportedType(currentType))
225 throw st.exception("$GENERATE does not support " +
226 Type.string(currentType) + " records");
227
228 // Next comes the rdata specification.
229 String rdataSpec = st.getIdentifier();
230
231 // That should be the end. However, we don't want to move past the
232 // line yet, so put back the EOL after reading it.
233 st.getEOL();
234 st.unget();
235
236 generator = new Generator(start, end, step, nameSpec,
237 currentType, currentDClass, currentTTL,
238 rdataSpec, origin);
239 if (generators == null)
240 generators = new ArrayList(1);
241 generators.add(generator);
242}
243
244private void
245endGenerate() throws IOException {

Callers 1

_nextRecordMethod · 0.95

Calls 10

parseUInt32Method · 0.95
parseTTLClassAndTypeMethod · 0.95
supportedTypeMethod · 0.95
stringMethod · 0.95
getIdentifierMethod · 0.80
indexOfMethod · 0.80
exceptionMethod · 0.80
getEOLMethod · 0.80
ungetMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected