Exemple #1
0
 /**
  * Returns a summary of the message
  *
  * @return "ofmsg=v=$version;t=$type:l=$len:xid=$xid"
  */
 public String toString() {
   return "snmpmsg"
       + ":v="
       + U8.f(this.getVersion())
       + ";t="
       + this.getType()
       + ";l="
       + this.getLengthU()
       + ";x="
       + U32.f(this.getXid());
 }
Exemple #2
0
  /**
   * Output a dpctl-styled string, i.e., only list the elements that are not wildcarded
   *
   * <p>A match-everything OFMatch outputs "OFMatch[]"
   *
   * @return "OFMatch[dl_src:00:20:01:11:22:33,nw_src:192.168.0.0/24,tp_dst:80]"
   */
  @Override
  public String toString() {

    String str = "";

    // l1
    if ((wildcards & OFPFW_IN_PORT) == 0) str += "," + STR_IN_PORT + "=" + U16.f(this.inputPort);

    // l2
    if ((wildcards & OFPFW_DL_DST) == 0)
      str += "," + STR_DL_DST + "=" + HexString.toHexString(this.dataLayerDestination);
    if ((wildcards & OFPFW_DL_SRC) == 0)
      str += "," + STR_DL_SRC + "=" + HexString.toHexString(this.dataLayerSource);
    if ((wildcards & OFPFW_DL_TYPE) == 0)
      str += "," + STR_DL_TYPE + "=0x" + Integer.toHexString(U16.f(this.dataLayerType));
    if ((wildcards & OFPFW_DL_VLAN) == 0)
      str += "," + STR_DL_VLAN + "=" + U16.f(this.dataLayerVirtualLan);
    if ((wildcards & OFPFW_DL_VLAN_PCP) == 0)
      str += "," + STR_DL_VLAN_PCP + "=" + U8.f(this.dataLayerVirtualLanPriorityCodePoint);

    // l3
    if (getNetworkDestinationMaskLen() > 0)
      str +=
          "," + STR_NW_DST + "=" + cidrToString(networkDestination, getNetworkDestinationMaskLen());
    if (getNetworkSourceMaskLen() > 0)
      str += "," + STR_NW_SRC + "=" + cidrToString(networkSource, getNetworkSourceMaskLen());
    if ((wildcards & OFPFW_NW_PROTO) == 0) str += "," + STR_NW_PROTO + "=" + this.networkProtocol;
    if ((wildcards & OFPFW_NW_TOS) == 0) str += "," + STR_NW_TOS + "=" + this.networkTypeOfService;

    // l4
    if ((wildcards & OFPFW_TP_DST) == 0) str += "," + STR_TP_DST + "=" + this.transportDestination;
    if ((wildcards & OFPFW_TP_SRC) == 0) str += "," + STR_TP_SRC + "=" + this.transportSource;
    if ((str.length() > 0) && (str.charAt(0) == ','))
      str = str.substring(1); // trim the leading ","
    // done
    return "OFMatch[" + str + "]";
  }