Package org.jnetpcap.packet.annotate

Examples of org.jnetpcap.packet.annotate.Header


    }

    AnnotatedHeaderLengthMethod[] methods =
        new AnnotatedHeaderLengthMethod[HeaderLength.Type.values().length];

    Header header = c.getAnnotation(Header.class);
    if (header != null && header.length() != -1) {
      methods[HeaderLength.Type.HEADER.ordinal()] =
          new AnnotatedHeaderLengthMethod(c, header.length(),
              HeaderLength.Type.HEADER);
    }

    if (header != null && header.prefix() != -1) {
      methods[HeaderLength.Type.PREFIX.ordinal()] =
          new AnnotatedHeaderLengthMethod(c, header.prefix(),
              HeaderLength.Type.PREFIX);
    }

    if (header != null && header.gap() != -1) {
      methods[HeaderLength.Type.GAP.ordinal()] =
          new AnnotatedHeaderLengthMethod(c, header.gap(),
              HeaderLength.Type.GAP);
    }

    if (header != null && header.payload() != -1) {
      methods[HeaderLength.Type.PAYLOAD.ordinal()] =
          new AnnotatedHeaderLengthMethod(c, header.payload(),
              HeaderLength.Type.PAYLOAD);
    }

    if (header != null && header.postfix() != -1) {
      methods[HeaderLength.Type.POSTFIX.ordinal()] =
          new AnnotatedHeaderLengthMethod(c, header.postfix(),
              HeaderLength.Type.POSTFIX);
    }

    for (Method method : getMethods(c, HeaderLength.class)) {
View Full Code Here


      List<HeaderDefinitionError> errors) {

    AnnotatedHeader header = new AnnotatedHeader(c);

    if (c.isAnnotationPresent(Header.class)) {
      Header a = c.getAnnotation(Header.class);

      if (JHeader.class.isAssignableFrom(c) == false) {
        /*
         * All headers must subclass JHeader.class, no exceptions.
         */

        errors.add(new HeaderDefinitionError(c,
            "header must subclass 'JHeader'"));
      }

      if (a.name().length() != 0) {
        header.name = a.name();
      } else {
        header.name = c.getSimpleName();
      }

      if (a.nicname().length() != 0) {
        header.nicname = a.nicname();
      } else {
        header.nicname = header.name;
      }

      if (a.description().length() != 0) {
        header.description = a.description();
      } else if (a.dlt().length != 0) {
        /*
         * Description comes from libpcap itself :)
         */
        header.description = a.dlt()[0].getDescription();

      } else {
        header.description = null;
      }

      if (a.id() != -1) {
        a.id();
      }

      if (a.parent() != JHeader.class) {
        header.parentClass = a.parent();
      }

      if (header.parentClass == null && c.getEnclosingClass() != null) {
        for (Class<?> p = c.getEnclosingClass(); p != null; p =
            p.getEnclosingClass()) {
View Full Code Here

TOP

Related Classes of org.jnetpcap.packet.annotate.Header

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.