* @return numerical id assigned to this new protocol
*/
public static int register(Class<? extends JHeader> c,
List<HeaderDefinitionError> errors) {
AnnotatedHeader annotatedHeader = inspect(c, errors);
if (errors.isEmpty() == false) {
return -1;
}
Entry e = mapByClassName.get(c.getCanonicalName());
if (e == null) {
e = createNewEntry(c);
}
int id = e.id;
e.annotatedHeader = annotatedHeader;
scanners[id] = new JHeaderScanner(c);
registerAnnotatedSubHeaders(annotatedHeader.getHeaders());
JBinding[] bindings = AnnotatedBinding.inspectJHeaderClass(c, errors);
if (errors.isEmpty() == false) {
return -1;
}
addBindings(bindings);
for (PcapDLT d : annotatedHeader.getDlt()) {
registerDLT(d, id);
}
return id;
}