403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files/SMSC client .NET/samples/delphi/SMPP/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Program Files/SMSC client .NET/samples/delphi/SMPP/Main.pas
//------------------------------------------------------------------------------
// SMSC Relay components SMPP sample application
//
// $Header: $
// Copyright (c) 2003-2013 Tops. All rights reserved.
//------------------------------------------------------------------------------

unit Main;

interface

uses
  Windows, Messages, SysUtils, Types, StdCtrls, Controls, Graphics, ExtCtrls,
  Forms, Dialogs, Classes, OleServer,

  EventLog, smscc_TLB, Variants, VarUtils, pngimage;

type
  TfmMain = class(TForm)
    Label1: TLabel;
    eHost: TEdit;
    Label2: TLabel;
    ePort: TEdit;
    bConnect: TButton;
    bDisconnect: TButton;
    Shape1: TShape;
    Label3: TLabel;
    Label8: TLabel;
    eSystemID: TEdit;
    ePassword: TEdit;
    bInitialize: TButton;
    Shape2: TShape;
    bSubmit: TButton;
    Label6: TLabel;
    eDestination: TEdit;
    Label7: TLabel;
    Label16: TLabel;
    mUDH: TMemo;
    Label15: TLabel;
    cEncoding: TComboBox;
    cbStatusReport: TCheckBox;
    cbDirectDisplay: TCheckBox;
    Shape3: TShape;
    Label17: TLabel;
    mLog: TMemo;
    Label9: TLabel;
    eOriginator: TEdit;
    Label10: TLabel;
    eSystemType: TEdit;
    eTON: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    eNPI: TEdit;
    eOrigTON: TEdit;
    Label12: TLabel;
    Label13: TLabel;
    eOrigNPI: TEdit;
    Label11: TLabel;
    eDestTON: TEdit;
    Label14: TLabel;
    eDestNPI: TEdit;
    mSubmit: TMemo;
    SMSCclientSMPP1: TSMSCclientSMPP;
    SMSCencoder1: TSMSCencoder;
    procedure bConnectClick(Sender: TObject);
    procedure bDisconnectClick(Sender: TObject);
    procedure bInitializeClick(Sender: TObject);
    procedure bSubmitClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure SMSCclientSMPP1TcpDisconnected(ASender: TObject;
      sender: OleVariant; const e: ITcpDisconnectedEventArgs);
    procedure SMSCclientSMPP1SmppMessageReceived(ASender: TObject;
      sender: OleVariant; const e: ISmppMessageReceivedEventArgs);
    procedure SMSCclientSMPP1SmppStatusReportReceived(ASender: TObject;
      sender: OleVariant; const e: ISmppStatusReportReceivedEventArgs);
  private
    FLog: TEventLog;
  public
  end;

var
  fmMain: TfmMain;

implementation

{$R *.dfm}

// Connect to SMSC
procedure TfmMain.bConnectClick(Sender: TObject);
var
  Result: integer;
begin
  mLog.Text := '';
  FLog.AddConnectingEvent;
  mLog.Refresh;

  Result := SMSCclientSMPP1.tcpConnect(eHost.Text, StrToInt(ePort.Text), '');

  if Result <> 0 then
    FLog.AddConnectionErrorEvent(Result)
  else
    FLog.AddConnectedEvent;
end;

// Disonnect from SMSC
procedure TfmMain.bDisconnectClick(Sender: TObject);
begin
  SMSCclientSMPP1.tcpDisconnect;
end;

// Initialize session with SMSC
procedure TfmMain.bInitializeClick(Sender: TObject);
var
  Result: integer;
begin
  Result := SMSCclientSMPP1.smppInitializeSession(eSystemID.Text, ePassword.Text,
    StrToInt(eTON.Text), StrToInt(eNPI.Text), eSystemType.Text);

  if Result <> 0 then
    FLog.AddInitializationErrorEvent(Result)
  else
    FLog.AddInitializedEvent;
end;

// Submit message to the SMSC
procedure TfmMain.bSubmitClick(Sender: TObject);
var
  Result: integer;
  Encoding: EncodingEnum;
  Options: SubmitOptionEnum;
  MessageID: WideString;
  mpm: IMultipartMessage;
  cLower, cCount, i: integer;
  pDisp: IDispatch;
  mp: IMessagePart;
begin
  case cEncoding.ItemIndex of
    2: Encoding := EncodingEnum_etUCS2Text;
    1: Encoding := EncodingEnum_et8BitHexadecimal;
  else Encoding := EncodingEnum_et7BitText;
  end;

  Options := 0;
  if cbStatusReport.State = cbChecked then
    Options := Options or SubmitOptionEnum_soRequestStatusReport;
  if cbDirectDisplay.State = cbChecked then
    Options := Options or SubmitOptionEnum_soDirectDisplay;

  // Create multipart representation of the message
  mpm := SMSCencoder1.EncodeMultipartMessage(
  	SplitMethodEnum_smUDH, WideString(mSubmit.Text),
    WideString(mUDH.Text), Encoding, '');

  cLower := mpm.Parts.rgsabound[0].lLbound;
  cCount := mpm.Parts.rgsabound[0].cElements;

  for i := cLower to cLower + cCount - 1 do begin

    SafeArrayLock(PVarArray(mpm.Parts));

    // Get element as pointer to IDispatch interface
    SafeArrayGetElement(PVarArray(mpm.Parts), @i, @pDisp);

    // Convert to IMessagePart
    mp := pDisp as IMessagePart;

    Result := SMSCclientSMPP1.smppSubmitMessage(eDestination.Text,
      StrToInt(eDestTON.Text), StrToInt(eDestNPI.Text), eOriginator.Text,
      StrToInt(eOrigTON.Text), StrToInt(eOrigNPI.Text), mp.Content, Encoding,
      mp.UDH, Options, MessageID);

    SafeArrayUnLock(PVarArray(mpm.Parts));

    if Result <> 0 then
      FLog.AddMessageSubmissionErrorEvent(Result)
    else
      FLog.AddMessageSubmitedEvent(MessageID);
  end;
end;

procedure TfmMain.FormCreate(Sender: TObject);
begin
  inherited;
  FLog := TEventLog.Create(mLog);
  cEncoding.ItemIndex := 0;
end;

procedure TfmMain.FormDestroy(Sender: TObject);
begin
  FLog.Free;
  inherited;
end;

// Disconnected from SMSC
procedure TfmMain.SMSCclientSMPP1TcpDisconnected(ASender: TObject;
  sender: OleVariant; const e: ITcpDisconnectedEventArgs);
begin
  FLog.AddDisconnectedEvent(e.Reason);
end;

// Message received from SMSC
procedure TfmMain.SMSCclientSMPP1SmppMessageReceived(ASender: TObject;
  sender: OleVariant; const e: ISmppMessageReceivedEventArgs);
var
  em: EncodedMessage;
  ii: IInterface;
begin
  em := SMSCencoder1.AddMessageToDecode(e.Destination, e.Originator, e.Content,
    e.UserDataHeader, e.Encoding, e.ExtendedParameters);

  if assigned(em) then begin

    if em.QueryInterface(IID__NoDecodingNeededMessage, ii) = 0 then begin

      FLog.AddMessageReceivedEvent(e.Destination, e.Originator, e.Content,
        e.Encoding, e.UserDataHeader);

    end else if em.QueryInterface(IID_IMultipartMessage, ii) = 0 then begin

      FLog.AddMessageReceivedEvent(e.Destination, e.Originator,
        (em as MultipartMessage).Content, e.Encoding,
        (em as MultipartMessage).UDH);

    end;
  end;
end;

// Status Report (SR) received from SMSC
procedure TfmMain.SMSCclientSMPP1SmppStatusReportReceived(ASender: TObject;
  sender: OleVariant; const e: ISmppStatusReportReceivedEventArgs);
begin
  FLog.AddStatusReportReceivedEvent(e.MessageID, e.Destination, e.Originator,
    e.MessageState, e.NetworkErrorCode);
end;

end.

Youez - 2016 - github.com/yon3zu
LinuXploit