/** * Construct a new instance. * * @param value A long value that indicates a datapath ID. */ public OfNode(long value) { nodeNumber = getUnsigned(value); }
/** * Set the source port number. * * @param port A short integer value which indicates the source port. * @return An integer value which indicates the source port. */ private int setSourcePort(short port) { sourcePort = NumberUtils.getUnsigned(port); return sourcePort; }
/** * Set the ICMP type. * * @param value A byte integer value which indicates the ICMP type. * @return A short value which represents the given ICMP type. */ private short setType(byte value) { type = (short)NumberUtils.getUnsigned(value); return type; }
/** * Set the ICMP code. * * @param value A byte integer value which indicates the ICMP code. * @return A short value which represents the given ICMP code. */ private short setCode(byte value) { code = (short)NumberUtils.getUnsigned(value); return code; }
/** * Set the destination port number. * * @param port A short integer value which indicates the destination * port. * @return An integer value which indicates the destination port. */ private int setDestinationPort(short port) { destinationPort = NumberUtils.getUnsigned(port); return destinationPort; }
/** * Return a {@link StringBuilder} instance that contains a string * representation of a node identifier. * * @return A {@link StringBuilder} instance. */ protected final StringBuilder toNodeStringBuilder() { StringBuilder builder = new StringBuilder(MD_ID_OPENFLOW); if (nodeNumber < 0) { // Datapath ID needs to be treated as unsigned. BigInteger bi = NumberUtils.getUnsigned(nodeNumber); builder.append(bi); } else { builder.append(nodeNumber); } return builder; }
/** * {@inheritDoc} */ @Override public short getProtocol() { if (protocol == PROTO_NONE) { protocol = (short)NumberUtils.getUnsigned(packet.getProtocol()); } return protocol; }
/** * Create a flow cookie from the given VTN flow ID. * * @param fid The identifier of the VTN data flow. * @return A {@link FlowCookie} instance. */ public static FlowCookie createCookie(VtnFlowId fid) { long value = fid.getValue().longValue() | COOKIE_BITS_VTN; return new FlowCookie(NumberUtils.getUnsigned(value)); }
/** * Return the VTN flow ID embedded in the given flow cookie. * * @param cookie A {@link FlowCookie} instance. * @return A {@link VtnFlowId} instance on success. * {@code null} on failure. */ public static VtnFlowId getVtnFlowId(FlowCookie cookie) { if (cookie == null) { return null; } long value = cookie.getValue().longValue(); if ((value & COOKIE_MASKVAL_VTN) != COOKIE_BITS_VTN) { return null; } long id = (value & ~COOKIE_MASKVAL_VTN); return new VtnFlowId(NumberUtils.getUnsigned(id)); }
/** * {@inheritDoc} */ @Override public short getDscp() { Values v = getValues(); short dscp = v.getDscp(); if (dscp == DSCP_NONE) { dscp = (short)NumberUtils.getUnsigned(packet.getDiffServ()); v.setDscp(dscp); } return dscp; }
/** * {@inheritDoc} */ @Override public short getVlanPriority() { Values v = getValues(); short pri = v.getVlanPriority(); if (pri == VLANPRI_NONE && vlanTag != null) { pri = (short)NumberUtils.getUnsigned(vlanTag.getPcp()); v.setVlanPriority(pri); } return pri; }
/** * Fetch all modifiable field values from the given packet. * * <p> * Field values already cached in this instance are preserved. * </p> * * @param ether An {@link Ethernet} instance. * @param tag An {@link IEEE8021Q} instance. */ private void fill(Ethernet ether, IEEE8021Q tag) { if (sourceAddress == null) { sourceAddress = new EtherAddress(ether.getSourceMACAddress()); } if (destinationAddress == null) { destinationAddress = new EtherAddress(ether.getDestinationMACAddress()); } if (vlanPriority == VLANPRI_NONE && tag != null) { vlanPriority = (short)NumberUtils.getUnsigned(tag.getPcp()); } }
setTransactionUri(new Uri(ub.toString())). setMatch(EMPTY_MATCH). setOutPort(NumberUtils.getUnsigned(sport.getPortNumber())). setStrict(false); list.add(egress);
/** * Construct a new instance. * * @param ether An {@link Ethernet} instance. */ public EtherPacket(Ethernet ether) { packet = ether; Packet parent = ether; Packet pld = ether.getPayload(); short ethType; short vid; if (pld instanceof IEEE8021Q) { // This packet has a VLAN tag. vlanTag = (IEEE8021Q)pld; pld = vlanTag.getPayload(); ethType = vlanTag.getEtherType(); parent = vlanTag; vid = vlanTag.getVid(); } else { ethType = ether.getEtherType(); vlanTag = null; vid = VLAN_NONE; } values = new Values(vid); etherType = NumberUtils.getUnsigned(ethType); payload = pld; rawPayload = parent.getRawPayload(); }