Examples of Flow


Examples of nz.co.abrahams.asithappens.flow.Flow

       
    }
   
    /** @return a Flow object corresponding to the next packet in the trace file */
    public Flow next() {
        Flow flow;
        Device sourceDevice;
        Device destinationDevice;
        IpAddressPrimitive source = null;
        IpAddressPrimitive destination = null;
        MacAddressPrimitive src = null;
        MacAddressPrimitive dst = null;
        int etherProtocol = -1;
        int ipProtocol = -1;
        int srcPort = -1;
        int dstPort = -1;
       
        try {
           
            /* Aligns the position of the stream at beginning of packet */
            in.nextPacket();
           
            /* Returns the name of the first header */
            String linkType = in.getLinkType();
            int length = (int)in.getPacketLength();
            long timestamp = in.getCaptureTimestamp().getTime();
           
            if (linkType.equals("Ethernet") == true) {
               
                dst = new MacAddressPrimitive();
                dst.setValue(in);
               
                src = new MacAddressPrimitive();
                src.setValue(in);
               
                etherProtocol = in.readUnsignedShort();
               
                // Now check if its IP protocol
                if (etherProtocol == 0x800) {
                    int version =       in.readBits(4);
                    int hlen =          in.readBits(4);
                    int precedence =    in.readBits(3);
                    //int delay =         in.readBits(1);
                    //int throughtput =   in.readBits(1);
                    //int reliability =   in.readBits(1);
                    //in.readBits(2);     // Reserved 2 bits
                   
                    //int ipLength =      in.readUnsignedShort();
                    //int id =            in.readUnsignedShort();
                   
                    //in.readBits(1);     // Reserved 1 flag bit
                   
                    //int doNotFragment = in.readBits(1);
                    //int moreFragments = in.readBits(1);
                   
                    in.readBits(32);
                    in.readBits(8);
                    int offset =        in.readBits(13);
                    int timeToLive =    in.readUnsignedByte();
                   
                    ipProtocol =    in.readUnsignedByte();
                    int checksum =      in.readUnsignedShort();
                   
                    source = new IpAddressPrimitive();
                    source.setValue(in);
                   
                    destination = new IpAddressPrimitive();
                    destination.setValue(in);
                   
                    // Skip all the options
                    if ( hlen > 5 )
                        in.readBits((hlen - 5) * 32);
                   
                    //logger.debug("Ethernet " + src + " -> " + dst);
                    //logger.debug("IP " + source + " -> " + destination);
                   
                    if (ipProtocol == 6) {
                        srcPort = in.readUnsignedShort();
                        dstPort = in.readUnsignedShort();
                        long seqNumber = in.readUnsignedInt();
                        long ackNumber = in.readUnsignedInt();
                       
                        //int ipOffset = in.readBits(4);
                        // reserved
                        //in.readBits(6);
                        //int flags = in.readBits(6);
                        //int window = in.readUnsignedShort();
                       
                        in.readBits(32);
                        if ( offset > 5 )
                            in.readBits((offset - 5) * 32);
                        logger.debug("TCP: " + source + "(" + srcPort + ") -> "
                                + destination + "(" + dstPort + ")");
                       
                    } else if (ipProtocol == 17) {
                        srcPort = in.readUnsignedShort();
                        dstPort = in.readUnsignedShort();
                       
                        //int udpLength = in.readUnsignedShort();
                        //int udpChecksum = in.readUnsignedShort();
                        in.readBits(32);
                        logger.debug("UDP: " + source + "(" + srcPort + ") -> "
                                + destination + "(" + dstPort + ")");
                       
                    } else { // For all other IP protocols display number
                        logger.debug(
                                "IP: " + source + " -> " + destination + " protocol=0x"
                                + Integer.toHexString(ipProtocol) );
                    }
                    sourceDevice = new Device(InetAddress.getByName(source.toString()), new EthernetAddress(src.toString()));
                    destinationDevice = new Device(InetAddress.getByName(destination.toString()), new EthernetAddress(dst.toString()));
                   
                    return new Flow(timestamp, sourceDevice, destinationDevice, etherProtocol, ipProtocol, srcPort, dstPort, length);
                   
                } else {
                    logger.debug("Ethernet " + src + " -> " + dst
                            + " Ethertype=0x"
                            + Integer.toHexString(etherProtocol) );
                    sourceDevice = new Device(new EthernetAddress(src.toString()));
                    destinationDevice = new Device(new EthernetAddress(dst.toString()));
                    return new Flow(timestamp, sourceDevice, destinationDevice, etherProtocol, length);
                }
            } else {
                logger.debug("Unsupported packet type: " + linkType);
                return next();
            }
View Full Code Here

Examples of nz.co.abrahams.asithappens.flow.Flow

    /**
     * Test of nextPacket method, of class nz.co.abrahams.asithappens.PacketTraceParser.
     */
    @Test
    public void testNext() {
        Flow flow;
        System.out.println("testNext");
        flow = iterator.next();
        flow = iterator.next();
        flow = iterator.next();
        Assert.assertTrue(true);
View Full Code Here

Examples of nz.co.abrahams.asithappens.flow.Flow

        device2 = new Device(InetAddress.getByName("10.1.2.3"), new EthernetAddress("00:11:D8:0C:25:22"));
        device3 = new Device(InetAddress.getByName("192.168.0.1"), new EthernetAddress("00:11:D8:0C:25:11"));
        device4 = new Device(InetAddress.getByName("10.1.2.3"), new EthernetAddress("00:11:D8:0C:25:22"));
        device5 = new Device(InetAddress.getByName("102.168.0.2"), new EthernetAddress("00:11:D8:0C:25:22"));
       
        flow1 = new Flow(1115641185, device1, device2, 2048, 6, 1025, 80, 100);
        flow2 = new Flow(1115641188, device3, device4, 2048, 6, 1025, 80, 200);
       
        flow3 = new Flow(1115641188, device1, device5, 2048, 6, 1025, 80, 300);
        flow4 = new Flow(1115641198, device1, device5, 2048, 6, 1029, 80, 300);
        flow5 = new Flow(1115641198, device2, device5, 2048, 6, 1034, 80, 300);
       
       
        destinationAddressPortOptions = new FlowOptions(true, false, true, false, false, true);
        ipProtocolOptions = new FlowOptions(true, false, false, false, false, false);
        destinationAddressOptions = new FlowOptions(true, false, true, false, false, false);
View Full Code Here

Examples of org.amplafi.flow.Flow

        ComponentTemplate ret = null;
        IComponentSpecification spec = component.getSpecification();
        boolean isFlowPage = FlowAwareSpecResolverDelegate.ID.equals(spec.getPublicId());
        if (isFlowPage || spec.getComponentClassName().equals(FullFlowComponent.class.getName())) {
            String type = spec.getDescription();
            Flow flow = flowDefinitionsManager.getFlowDefinition(type);
            // build the content for this full flow component
            String content;
            if (flow == null) {
                content = "<div>[Flow " + type + " not found]</div>";
            } else if ( CollectionUtils.isEmpty(flow.getActivities())) {
                content = "<div>[Flow " + type + " has no activites]</div>";
            } else {
                content = isFlowPage ?
                        createPageTemplate(flow, cycle, component.getNamespace(), component.getLocation()) :
                        createComponentTemplate(flow, cycle, component.getNamespace(), component.getLocation());
View Full Code Here

Examples of org.apache.axis2.description.Flow

    }

    public static void addNewModule(AxisModule modulemetadata,
                                    AxisConfiguration axisConfiguration) throws AxisFault {

        Flow inflow = modulemetadata.getInFlow();
        ClassLoader moduleClassLoader = modulemetadata.getModuleClassLoader();

        if (inflow != null) {
            Utils.addFlowHandlers(inflow, moduleClassLoader);
        }

        Flow outFlow = modulemetadata.getOutFlow();

        if (outFlow != null) {
            Utils.addFlowHandlers(outFlow, moduleClassLoader);
        }

        Flow faultInFlow = modulemetadata.getFaultInFlow();

        if (faultInFlow != null) {
            Utils.addFlowHandlers(faultInFlow, moduleClassLoader);
        }

        Flow faultOutFlow = modulemetadata.getFaultOutFlow();

        if (faultOutFlow != null) {
            Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
        }
View Full Code Here

Examples of org.apache.fop.fo.flow.Flow

            else
            {
                BodyAreaContainer bodyArea = currentPage.getBody();
                bodyArea.setIDReferences(areaTree.getIDReferences());
   
    Flow flow = getCurrentFlow(RegionBody.REGION_CLASS);
   
    if (null == flow) {
         MessageHandler.errorln("No flow found for region-body "
              + "in page-master '" + currentPageMasterName + "'");
        break;
       
    }
    else {
        status = flow.layout(bodyArea);
    }
   
            }
            MessageHandler.log("]");
            areaTree.addPage(currentPage);
View Full Code Here

Examples of org.apache.fop.fo.flow.Flow

  throws FOPException
    {
  SimplePageMaster simpleMaster = getCurrentSimplePageMaster();

  if (simpleMaster.getRegion(RegionBefore.REGION_CLASS) != null && (currentPage.getBefore() != null)) {
      Flow staticFlow = (Flow)_flowMap.get(simpleMaster.getRegion(RegionBefore.REGION_CLASS).getRegionName());
      if (staticFlow != null) {
    AreaContainer beforeArea = currentPage.getBefore();
    beforeArea.setIDReferences(areaTree.getIDReferences());
    layoutStaticContent(staticFlow, simpleMaster.getRegion(RegionBefore.REGION_CLASS),
            beforeArea);
      }
  }

  if (simpleMaster.getRegion(RegionAfter.REGION_CLASS) != null && (currentPage.getAfter() != null)) {
      Flow staticFlow = (Flow)_flowMap.get(simpleMaster.getRegion(RegionAfter.REGION_CLASS).getRegionName());
      if (staticFlow != null) {
    AreaContainer afterArea = currentPage.getAfter();
    afterArea.setIDReferences(areaTree.getIDReferences());
    layoutStaticContent(staticFlow, simpleMaster.getRegion(RegionAfter.REGION_CLASS),
            afterArea);
View Full Code Here

Examples of org.apache.fop.fo.flow.Flow

    private boolean flowsAreIncomplete()
    {
  boolean isIncomplete = false;

  for (Enumeration e = _flowMap.elements(); e.hasMoreElements(); ) {
      Flow flow = (Flow)e.nextElement();
      if (flow instanceof StaticContent) {
    continue;
      }
     
      Status status = flow.getStatus();
      isIncomplete |= status.isIncomplete();
  }
  return isIncomplete;
    }
View Full Code Here

Examples of org.apache.fop.fo.flow.Flow

     */
    private Flow getCurrentFlow(String regionClass)
    {
  Region region = getCurrentSimplePageMaster().getRegion(regionClass);
        if (region != null) {
      Flow flow = (Flow)_flowMap.get(region.getRegionName());
      return flow;
     
  }
  else {
     
View Full Code Here

Examples of org.apache.fop.fo.flow.Flow

   
      SimplePageMaster spm = this.layoutMasterSet.getSimplePageMaster( masterName );
      Region region = spm.getRegion(RegionBody.REGION_CLASS);
     
     
      Flow flow = (Flow)_flowMap.get( region.getRegionName() );
      if ((null == flow) || flow.getStatus().isIncomplete())
    return false;
      else
    return true;
  }
  return false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.