X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fpacket%2FTCP.java;h=d27494599c280418044e4ef78210678562852cc0;hb=c7551f594c34504fffa0055d3360132577938b38;hp=c7c7f99279d7528d6b5393ead637a02c4295aaf5;hpb=66b4fbc0fd997591f71745f514013484abb30175;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/TCP.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/TCP.java index c7c7f99279..d27494599c 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/TCP.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/TCP.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -15,22 +15,24 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.opendaylight.controller.sal.match.Match; +import org.opendaylight.controller.sal.match.MatchType; /** * Class that represents the TCP segment objects */ public class TCP extends Packet { - private static final String SRCPORT = "SourcePort"; - private static final String DESTPORT = "DestinationPort"; - private static final String SEQNUMBER = "SequenceNumber"; - private static final String ACKNUMBER = "AcknoledgementNumber"; - private static final String DATAOFFSET = "DataOffset"; - private static final String RESERVED = "Reserved"; - private static final String HEADERLENFLAGS = "HeaderLenFlags"; - private static final String WINDOWSIZE = "WindowSize"; - private static final String CHECKSUM = "Checksum"; - private static final String URGENTPOINTER = "UrgentPointer"; + public static final String SRCPORT = "SourcePort"; + public static final String DESTPORT = "DestinationPort"; + public static final String SEQNUMBER = "SequenceNumber"; + public static final String ACKNUMBER = "AcknowledgementNumber"; + public static final String DATAOFFSET = "DataOffset"; + public static final String RESERVED = "Reserved"; + public static final String HEADERLENFLAGS = "HeaderLenFlags"; + public static final String WINDOWSIZE = "WindowSize"; + public static final String CHECKSUM = "Checksum"; + public static final String URGENTPOINTER = "UrgentPointer"; private static Map> fieldCoordinates = new LinkedHashMap>() { private static final long serialVersionUID = 1L; @@ -230,4 +232,17 @@ public class TCP extends Packet { return (BitBufferHelper.getShort(fieldValues.get(DESTPORT))); } + /** + * Get the stored checksum value of the TCP header + * @return short - the checksum + */ + public short getChecksum() { + return (BitBufferHelper.getShort(fieldValues.get(CHECKSUM))); + } + + @Override + public void populateMatch(Match match) { + match.setField(MatchType.TP_SRC, this.getSourcePort()); + match.setField(MatchType.TP_DST, this.getDestinationPort()); + } }