Examples of TLV


Examples of cn.com.zjtelecom.smgp.protocol.Tlv

    } else if (tag == TlvId.Mserviceid) {
      this.ProductID = value;
    } else {
      if (this.OtherTlvArray == null) {
        Tlv[] tmp = new Tlv[1];
        tmp[0] = new Tlv(tag, value);
        this.OtherTlvArray = tmp;
      } else {
        Tlv[] tmp = new Tlv[OtherTlvArray.length + 1];
        System
            .arraycopy(OtherTlvArray, 0, tmp, 0,
                OtherTlvArray.length);
        tmp[OtherTlvArray.length] = new Tlv(tag, value);
        this.OtherTlvArray = tmp;
      }
    }
  }
View Full Code Here

Examples of com.cloudhopper.smpp.tlv.Tlv

            bound = true;

            //
            // negotiate version in use based on response back from server
            //
            Tlv scInterfaceVersion = bindResponse.getOptionalParameter(SmppConstants.TAG_SC_INTERFACE_VERSION);

            if (scInterfaceVersion == null) {
                // this means version 3.3 is in use
                this.interfaceVersion = SmppConstants.VERSION_3_3;
            } else {
                try {
                    byte tempInterfaceVersion = scInterfaceVersion.getValueAsByte();
                    if (tempInterfaceVersion >= SmppConstants.VERSION_3_4) {
                        this.interfaceVersion = SmppConstants.VERSION_3_4;
                    } else {
                        this.interfaceVersion = SmppConstants.VERSION_3_3;
                    }
View Full Code Here

Examples of com.sun.satsa.util.TLV

     * Tests DER encoding of DomainComponent.
     */
    private void testOne() {
        String nameInfo =
            "cn=Certificate, dc=www, Dc=sun, dC=com";
        TLV name;
        boolean ok = true;

        try {
            name = new TLV(RFC2253Name.toDER(nameInfo), 0);
        } catch (TLVException e) {
            name = null;
            ok = false;
        }
        assertTrue("Invalid name", ok);
        assertTrue("Bad DER result", name != null &&
                    equal(name.getDERData(), testOneResult));
    }
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

            case CONNECTING :

                if (cmd.getChannel() == FlapConstants.FLAP_CHANNEL_DISCONNECT) {

                    // get the server and cookie from the command tlv
                    TLV tlvServer = cmd.getTLV(TLVConstants.TLV_TYPE_SERVER);
                    TLV tlvCookie = cmd.getTLV(TLVConstants.TLV_TYPE_COOKIE);
                    TLV tlvError = cmd.getTLV(TLVConstants.TLV_TYPE_ERROR_CODE);

                    if ((tlvServer != null) && (tlvCookie != null)) {
                        // hack the port to 22 now that work firewall blocks real port
                        int port =  5190;// 22;

                        try {
                            String server = null;
                            String serverCookie = tlvServer.getStringValue();
                            int pos = serverCookie.indexOf(':');

                            if (pos != -1) {
                                server = serverCookie.substring(0, pos);
                                port = Integer.parseInt(serverCookie.substring(pos+1));
                            } else {
                                server = serverCookie;
                            }

                            reconnect(server, port);
                        } catch (IllegalStateException e) {
                            e.printStackTrace();
                        }

                        // Login to BOS Server with Cookie
                        state = BOS_CONNECTING;
                        sendToWriterThread(new BOSLoginCmd(tlvCookie.getValue()));
                    } else if (tlvError != null) {
                        log.severe("Authentication error - error code=0x" + ByteUtils.toHexString(tlvError.getValue()));
                    }
                }
                break;

            case BOS_CONNECTING :
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

     * Constructor
     * @param cookie authorization cookie from the server
     */
    public BOSLoginCmd(byte[] cookie) {
        flapHdr = new FlapHeader(FlapConstants.FLAP_CHANNEL_CONNECT, 2);
        addTLV( new TLV(TLVConstants.TLV_TYPE_COOKIE, cookie) )
    }
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

    private static final byte[]  MINOR_VER  = MAJOR_VER;

    public LoginCmd(String screenName, String password)  {
        flapHdr = new FlapHeader(FlapConstants.FLAP_CHANNEL_CONNECT, 1);
   
        addTLV( new TLV(TLVConstants.TLV_TYPE_SCREEN_NAME, screenName) )
        addTLV( new TLV(TLVConstants.TLV_TYPE_ROASTED_PASSWORD, ByteUtils.roast(password)) )
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_ID_STRING, "HAMSAM Test Client"));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_ID, MAJOR_VER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_MAJOR_VERSION, MAJOR_VER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_MINOR_VERSION, MINOR_VER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_LESSOR_VERSION, MINOR_VER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_BUILD_NUMBER, MINOR_VER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_DISTRIBUTION_NUMBER, ID_NUMBER));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_LANGUAGE, "en"));
        addTLV( new TLV(TLVConstants.TLV_TYPE_CLIENT_COUNTRY, "us"));
       
    }
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

    public String getMessageText() {
        String msg = null;
        if (tlvList != null && !tlvList.isEmpty()) {
            outer : for (Iterator iter = tlvList.iterator(); iter.hasNext();) {
                TLV tlv = (TLV)iter.next();
                if (tlv.getType() == TLV_MSG_DATA) {
                    byte[] innerTlvs = tlv.getValue();
                    List list = TLV.getTLVs(innerTlvs, 0);
                    if (list != null && !list.isEmpty()) {
                        for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                            TLV element = (TLV)iterator.next();
                            if (element.getType() == TLV_MSG_TEXT) {
                                byte[] temp = element.getValue();
                                byte[] text = new byte[temp.length-4];
                                System.arraycopy(temp, 4, text, 0, temp.length - 4);
                                msg = new String(text);
                                break outer;
                            }
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

     * Get the TLV for the type requested from the Command
     * @param tlvid TLV type id
     * @return TLV object or null if matching TLV type not found
     */
    public TLV getTLV(int tlvid) {
        TLV tlv = null;
        if (tlvList != null && !tlvList.isEmpty() ) {
            for (Iterator iter = tlvList.iterator(); iter.hasNext();) {
                TLV element = (TLV)iter.next();
                if (tlvid == element.getType()) {
                    tlv = element;
                    break;
                }
            }   
        }
View Full Code Here

Examples of hamsam.protocol.aim.util.TLV

        flapHdr = new FlapHeader(FlapConstants.FLAP_CHANNEL_SNAC, seqNum);
        snacPacket = new SNACPacket(SNACConstants.SNAC_FAMILY_GENERIC_SERVICE_CONTROLS, SNACConstants.CLIENT_STATUS);

        statusFlags |= statusflag;
        byte[] flags = ByteUtils.getUInt( modeFlags | statusFlags );
        addTLV( new TLV(TLVConstants.TLV_TYPE_USER_STATUS_FLAGS, flags ) );

        // allocate bytes for the DC Info block
        byte[] dcinfo = new byte[ 0x25 ];

        InetAddress addr;
        try {
            addr = InetAddress.getLocalHost();
            byte[] ipAddr = addr.getAddress();
            System.arraycopy(ipAddr, 0, dcinfo, 0, ipAddr.length);
        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
        }
       
       
        dcinfo[8] = 0x04; // dc_type_normal
        System.arraycopy(unknownFields, 0, dcinfo, 9, unknownFields.length);

        addTLV( new TLV(TLVConstants.TLV_TYPE_DC_INFO, dcinfo) );


    }
View Full Code Here

Examples of net.gescobar.smppserver.packet.Tlv

      Assert.assertEquals( packet.getCommandId(), SmppPacket.SUBMIT_SM );

      SubmitSm submitSm = (SubmitSm) packet;
      Assert.assertEquals( submitSm.getShortMessage(), "This is a long message to test how the smpp is working with long message splitting them by the 160 character and sending two messages. Finish the first message ");

      Tlv totalTlv = submitSm.getOptionalParameter(SmppConstants.TAG_SAR_TOTAL_SEGMENTS);
      Assert.assertNotNull(totalTlv);
      Assert.assertEquals(ByteArrayUtil.toByte(totalTlv.getValue()), 2);

      Tlv segmentTlv = submitSm.getOptionalParameter(SmppConstants.TAG_SAR_SEGMENT_SEQNUM);
      Assert.assertNotNull(segmentTlv);
      Assert.assertEquals(ByteArrayUtil.toByte(segmentTlv.getValue()), 1);

      Tlv msgRefTlv = submitSm.getOptionalParameter(SmppConstants.TAG_SAR_MSG_REF_NUM);
      Assert.assertNotNull(msgRefTlv);

      packet = packets.get(1);
      Assert.assertNotNull(packet);
      Assert.assertEquals( packet.getCommandId(), SmppPacket.SUBMIT_SM );
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.