Package org.jnetpcap.packet.structure

Examples of org.jnetpcap.packet.structure.AnnotatedHeader


  /**
   * Test2.
   */
  public void test2() {

    AnnotatedHeader ah1 =
        AnnotatedHeader.inspectJHeaderClass(TestSubHeader.Sub1.Sub2.Sub3.class,
            errors);

    AnnotatedHeader ah2 =
        AnnotatedHeader.inspectJHeaderClass(TestSubHeader.Sub1.Sub2.Sub3.class,
            errors);

    assertTrue(ah1 == ah2); // Check if cached properly

View Full Code Here


  /**
   * Test with my header.
   */
  public void testWithMyHeader() {
    @SuppressWarnings("unused")
    AnnotatedHeader ah1 =
        AnnotatedHeader.inspectJHeaderClass(MyHeader.class, errors);

  }
View Full Code Here

   *
   * @throws IOException
   *           Signals that an I/O exception has occurred.
   */
  public void testIp4() throws IOException {
    AnnotatedHeader ah1 =
        AnnotatedHeader.inspectJHeaderClass(Ip4.class, errors);

    AnnotatedField[] afs = ah1.getFields();
    JField[] fields = DefaultField.fromAnnotatedFields(afs);

    for (JField field : fields) {
      System.out.printf("field=%s\n", field.toString());
    }
View Full Code Here

   * @return numerical ID of the protocol header
   */
  public static int lookupId(Class<? extends JHeader> c) {

    if (JSubHeader.class.isAssignableFrom(c)) {
      AnnotatedHeader header =
          lookupAnnotatedSubHeader((Class<? extends JSubHeader<? extends JSubHeader<?>>>) c);

      return header.getId();
    }

    Entry e = mapByClassName.get(c.getCanonicalName());
    if (e == null) {
      e = createNewEntry(c);
View Full Code Here

    order(ByteOrder.BIG_ENDIAN); // network byte order by default
    state = new State(Type.POINTER);

    final JProtocol protocol = JProtocol.valueOf(getClass());

    AnnotatedHeader header;
    if (protocol != null) {
      this.id = protocol.getId();
      header = JRegistry.lookupAnnotatedHeader(protocol);

    } else {
View Full Code Here

    super(Type.POINTER);
    order(ByteOrder.BIG_ENDIAN); // network byte order by default
    state = new State(Type.POINTER);

    this.id = protocol.getId();
    AnnotatedHeader header = JRegistry.lookupAnnotatedHeader(protocol);

    initFromAnnotatedHeader(header);
  }
View Full Code Here

   * @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;
  }
View Full Code Here

TOP

Related Classes of org.jnetpcap.packet.structure.AnnotatedHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.