Package se.sics.jipv6.tunnel

Examples of se.sics.jipv6.tunnel.TSPClient


  public void run() {
    IPv6Packet ping = new IPv6Packet();
    ping.setDestinationAddress(GOOGLE);
    ping.setSourceAddress(ipStack.getIPAddress());
    ICMP6Packet icmpER = new ICMP6Packet();
    icmpER.setType(ICMP6Packet.ECHO_REQUEST);
    ping.setIPPayload(icmpER);
    while(true) {
      try {
        Thread.sleep(10000);
      } catch (InterruptedException e) {
View Full Code Here


      0x00, 0x000x00, 0x000x00, 0x000x00, 0x68
  };
  static IPStack ipStack;
 
  public static void main(String[] args) {
    ipStack = new IPStack();
    TSPTest testLink = new TSPTest();
    ipStack.setLinkLayerHandler(testLink);
    TSPClient tunnel = TSPClient.startTSPTunnel(ipStack, "anon.freenet6.net", null, null);
    ipStack.setTunnel(tunnel);
   
View Full Code Here

        listener = new CC2420PacketHandler(cpu);
        listener.setOutput(context.out);
        IEEE802154Handler ieeeHandler = new IEEE802154Handler();
        listener.addUpperLayerHandler(0, ieeeHandler);
        ieeeHandler.setLowerLayerHandler(listener);
        ipStack = new IPStack();
        byte[] macAddr = new byte[] {0x2,0x12,0x74,0x00,0x11,0x11,0x12,0x12};
        ipStack.setLinkLayerAddress(macAddr);
        ipStack.setRouter(true);
        LoWPANHandler lowpanHandler = new LoWPANHandler();
        lowpanHandler.setIPStack(ipStack);
View Full Code Here

    new Thread(testLink).start();
  
  }

  public void run() {
    IPv6Packet ping = new IPv6Packet();
    ping.setDestinationAddress(GOOGLE);
    ping.setSourceAddress(ipStack.getIPAddress());
    ICMP6Packet icmpER = new ICMP6Packet();
    icmpER.setType(ICMP6Packet.ECHO_REQUEST);
    ping.setIPPayload(icmpER);
    while(true) {
      try {
        Thread.sleep(10000);
      } catch (InterruptedException e) {
        e.printStackTrace();
View Full Code Here

    case PACKET:
      if (pos == packetLen + PREAMBLE.length + 1) {
        /* the packet is in!!! */
//        CC2420Packet packet = new CC2420Packet();
//        packet.setPayload(packetBuffer, PREAMBLE.length + 1, packetLen - 2);
        Packet packet = new Packet();
        packet.setBytes(packetBuffer, PREAMBLE.length + 1, packetLen - 2);
        packet.setAttribute(CC2420_LEN, packet.getTotalLength());
        dispatch(-1, packet);
        System.out.println("CC2420: Packet received");

        /* this is a packet that has passed the stack! */
        mode = SFD_SEARCH;
View Full Code Here

    }
    out.println();
  }

  public void sendPacket(Packet packet) {
    final Packet sendPacket = packet;
    byte[] size = new byte[1];
    byte[] crc = new byte[2];
    size[0] = (byte) ((packet.getTotalLength() + 2)& 0xff);
    packet.prependBytes(size);
    packet.prependBytes(PREAMBLE);
    packet.appendBytes(crc);
    byte[] data = packet.getBytes();
    System.out.println("Should send packet to radio!!!! " + packet.getTotalLength());
    // Stuff to send to radio!!!
    TimeEvent te = new TimeEvent(0) {
      public void execute(long t) {
        System.out.println("CC2420: Packet to send: ");
        byte[] buffer = sendPacket.getBytes();
        for (int i = 0; i < buffer.length; i++) {
          System.out.print(Utils.hex8(buffer[i]));
          out.print(Utils.hex8(buffer[i]));
        }
        /* send to output + two additional bytes...! */
 
View Full Code Here

      CC2420PacketHandler listener;
      public int executeCommand(CommandContext context) {
        MSP430 cpu = registry.getComponent(MSP430.class);
        listener = new CC2420PacketHandler(cpu);
        listener.setOutput(context.out);
        IEEE802154Handler ieeeHandler = new IEEE802154Handler();
        listener.addUpperLayerHandler(0, ieeeHandler);
        ieeeHandler.setLowerLayerHandler(listener);
        ipStack = new IPStack();
        byte[] macAddr = new byte[] {0x2,0x12,0x74,0x00,0x11,0x11,0x12,0x12};
        ipStack.setLinkLayerAddress(macAddr);
        ipStack.setRouter(true);
        LoWPANHandler lowpanHandler = new LoWPANHandler();
        lowpanHandler.setIPStack(ipStack);
        ieeeHandler.addUpperLayerHandler(0, lowpanHandler);
        lowpanHandler.setLowerLayerHandler(ieeeHandler);
        ipStack.setLinkLayerHandler(lowpanHandler);
        context.err.print("IP Stack started");
        return 0;
      }
View Full Code Here

        ieeeHandler.setLowerLayerHandler(listener);
        ipStack = new IPStack();
        byte[] macAddr = new byte[] {0x2,0x12,0x74,0x00,0x11,0x11,0x12,0x12};
        ipStack.setLinkLayerAddress(macAddr);
        ipStack.setRouter(true);
        LoWPANHandler lowpanHandler = new LoWPANHandler();
        lowpanHandler.setIPStack(ipStack);
        ieeeHandler.addUpperLayerHandler(0, lowpanHandler);
        lowpanHandler.setLowerLayerHandler(ieeeHandler);
        ipStack.setLinkLayerHandler(lowpanHandler);
        context.err.print("IP Stack started");
        return 0;
      }
     
View Full Code Here

 
  public static void main(String[] args) {
    ipStack = new IPStack();
    TSPTest testLink = new TSPTest();
    ipStack.setLinkLayerHandler(testLink);
    TSPClient tunnel = TSPClient.startTSPTunnel(ipStack, "anon.freenet6.net", null, null);
    ipStack.setTunnel(tunnel);
   
    new Thread(testLink).start();
  
  }
View Full Code Here

      }
    });

    handler.registerCommand("tspstart", new BasicCommand("starts a TSP tunnel", "<server> <user> <password>") {
      public int executeCommand(CommandContext context) {
        TSPClient tunnel = TSPClient.startTSPTunnel(ipStack, context.getArgument(0),
            context.getArgument(1), context.getArgument(2));
        ipStack.setTunnel(tunnel);
        if (tunnel != null) {
          context.out.print("TSP Tunnel started");
          return 0;
View Full Code Here

TOP

Related Classes of se.sics.jipv6.tunnel.TSPClient

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.