[fpc-pascal] ExtractFilePath(GetModuleName(0)) problem

2009-04-10 Thread lloyd thomas
Need Help please "confini :=
ExtractFilePath(GetModuleName(0))+'\myfile.ini';" returns C:Program
FilesMyApp\myfile.ini should be C:\Program Files\MyApp\myfile.ini . Am I
doing something wrong?

The Problem is intermitent

{$IFDEF Windows}
confini  := ExtractFilePath(GetModuleName(0))+'\Myfile.ini';
{$ENDIF}
{$IFDEF Linux}
confini  := GetAppConfigDir(True)+'/callcollex.conf';
{$ENDIF}

   IniFile := TIniFile.Create(confini);

returns  an  error as follows
project raised exception class 'EFopenError' with message:
Unable to open file "C:Program FilesMyApp\myfile.ini"
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] ExtractFilePath(GetModuleName(0)) problem

2009-04-12 Thread lloyd thomas
Need Help please "confini :=
ExtractFilePath(GetModuleName(0))+'\myfile.ini';" returns C:Program
FilesMyApp\myfile.ini should be C:\Program Files\MyApp\myfile.ini . Am
I doing something wrong?

The Problem is intermitent

{$IFDEF Windows}
confini  := ExtractFilePath(GetModuleName(0))+'\Myfile.ini';
{$ENDIF}
{$IFDEF Linux}
confini  := GetAppConfigDir(True)+'/callcollex.conf';
{$ENDIF}

   IniFile := TIniFile.Create(confini);

returns  an  error as follows
project raised exception class 'EFopenError' with message:
Unable to open file "C:Program FilesMyApp\myfile.ini"
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Help Reading SIP Messages.

2010-01-05 Thread lloyd thomas
Please forgive my ignorance regarding the project I am about to embark on.
Need some advice on Lnet and capturing SIP RTP data to file. In the first
instance I just need to work with the sip messages. I believe the SIP
messages are similar to HTTP. I am using wireshark to understand how the SIP
messages are processed, but I am not sure how to capture and read each frame
(wireshark speak) using Lnet.

(FYI:
http://en.wikipedia.org/wiki/Session_Initiation_Protocol#SIP_network_elements
)

For instance the following is from frame 12 (935 bytes)
--
INVITE sip:1...@192.168.91.200  SIP/2.0
Via:SIP/2.0/UDP 192.168.91.190:5060;rport;branch=z9hG4bK83570061
From:"Lloyd" 
>;tag=4b428357-2fa-1ec5d4e
To:>
Contact:"Lloyd" 
Call-ID:8357-4ce59...@192.168.91.200
Subject:sip phone call
CSeq:2112045024 INVITE
User-Agent:Mitel-5212-SIP-Phone 07.02.00.04 08000F24BEE5
Allow:INVITE,ACK,CANCEL,BYE,OPTIONS,REFER,NOTIFY,PRACK,UPDATE
Allow-Events:talk,hold,conference
Supported:timer,100rel,replaces
Session-Expires: 1800
Min-SE: 90
Max-Forwards:70
Content-Type:application/sdp
Content-Length:247

v=0
o=1000 1262650963 1262650962 IN IP4 192.168.91.190
s=SIP Call
c=IN IP4 192.168.91.190
t=0 0
a=sendrecv
m=audio 20036 RTP/AVP 0 8 18 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:96 telephone-event/8000
---

I get a response from the sip server on frame 13 (371 bytes)
--
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.91.190:5060;rport=5060;branch=z9hG4bK83570061
From: "Lloyd" 
>;tag=4b428357-2fa-1ec5d4e
To: >
Call-ID: 8357-4ce59...@192.168.91.200
CSeq: 2112045024 INVITE
User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-15355M
Content-Length: 0
---
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-05 Thread lloyd thomas
OK. I wish to monitor and record calls between a SIP endpoint and SIP
Gateway. At the moment I am doing that by connecting the SIP endpoint and my
machine to an ethernet hub so that I can see all the traffic.
In the first instance I just need to correctly capture, read and interprete
the SIP messages so that I can make an informed decision which RDP packets
to capture.

Then I suppose I will have an even harder task capturing the RDP packets and
joining both legs together (my coding skills is not great)!

Lloydie T

2010/1/5 ik 

> Hello,
>
> SIP first of all uses UDP most of the times (and rarely TCP) .
> It only create a tunnel that other protocols such as RDP and SDP are going
> inside.
>
> Can you explain a bit more what exactly do you wish to implement (i'm not
> sure that I understand) ?
>
> Ido
>
> http://ik.homelinux.org/
>
>
> On Tue, Jan 5, 2010 at 15:08, lloyd thomas wrote:
>
>> Please forgive my ignorance regarding the project I am about to embark on.
>> Need some advice on Lnet and capturing SIP RTP data to file. In the first
>> instance I just need to work with the sip messages. I believe the SIP
>> messages are similar to HTTP. I am using wireshark to understand how the SIP
>> messages are processed, but I am not sure how to capture and read each frame
>> (wireshark speak) using Lnet.
>>
>> (FYI:
>> http://en.wikipedia.org/wiki/Session_Initiation_Protocol#SIP_network_elements
>> )
>>
>> For instance the following is from frame 12 (935 bytes)
>>
>> --
>> INVITE sip:1...@192.168.91.200  SIP/2.0
>> Via:SIP/2.0/UDP 192.168.91.190:5060;rport;branch=z9hG4bK83570061
>> From:"Lloyd" 
>> >;tag=4b428357-2fa-1ec5d4e
>> To:>
>> Contact:"Lloyd" 
>> Call-ID:8357-4ce59...@192.168.91.200
>> Subject:sip phone call
>> CSeq:2112045024 INVITE
>> User-Agent:Mitel-5212-SIP-Phone 07.02.00.04 08000F24BEE5
>> Allow:INVITE,ACK,CANCEL,BYE,OPTIONS,REFER,NOTIFY,PRACK,UPDATE
>> Allow-Events:talk,hold,conference
>> Supported:timer,100rel,replaces
>> Session-Expires: 1800
>> Min-SE: 90
>> Max-Forwards:70
>> Content-Type:application/sdp
>> Content-Length:247
>>
>> v=0
>> o=1000 1262650963 1262650962 IN IP4 192.168.91.190
>> s=SIP Call
>> c=IN IP4 192.168.91.190
>> t=0 0
>> a=sendrecv
>> m=audio 20036 RTP/AVP 0 8 18 96
>> a=rtpmap:0 PCMU/8000
>> a=rtpmap:8 PCMA/8000
>> a=rtpmap:18 G729/8000
>> a=rtpmap:96 telephone-event/8000
>>
>> ---
>>
>> I get a response from the sip server on frame 13 (371 bytes)
>>
>> --
>> SIP/2.0 100 Trying
>> Via: SIP/2.0/UDP 192.168.91.190:5060;rport=5060;branch=z9hG4bK83570061
>> From: "Lloyd" 
>> >;tag=4b428357-2fa-1ec5d4e
>> To: >
>> Call-ID: 8357-4ce59...@192.168.91.200
>> CSeq: 2112045024 INVITE
>> User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-15355M
>> Content-Length: 0
>>
>> ---
>>
>>
>>
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-05 Thread lloyd thomas
Also came across this which uses pcap, but seems to be delphi only
http://www.magsys.co.uk/delphi/magmonsock.asp

is there something similar for fpc?

2010/1/5 lloyd thomas 

> OK. I wish to monitor and record calls between a SIP endpoint and SIP
> Gateway. At the moment I am doing that by connecting the SIP endpoint and my
> machine to an ethernet hub so that I can see all the traffic.
> In the first instance I just need to correctly capture, read and interprete
> the SIP messages so that I can make an informed decision which RDP packets
> to capture.
>
> Then I suppose I will have an even harder task capturing the RDP packets
> and joining both legs together (my coding skills is not great)!
>
> Lloydie T
>
> 2010/1/5 ik 
>
> Hello,
>>
>> SIP first of all uses UDP most of the times (and rarely TCP) .
>> It only create a tunnel that other protocols such as RDP and SDP are going
>> inside.
>>
>> Can you explain a bit more what exactly do you wish to implement (i'm not
>> sure that I understand) ?
>>
>> Ido
>>
>> http://ik.homelinux.org/
>>
>>
>> On Tue, Jan 5, 2010 at 15:08, lloyd thomas wrote:
>>
>>> Please forgive my ignorance regarding the project I am about to embark
>>> on.
>>> Need some advice on Lnet and capturing SIP RTP data to file. In the first
>>> instance I just need to work with the sip messages. I believe the SIP
>>> messages are similar to HTTP. I am using wireshark to understand how the SIP
>>> messages are processed, but I am not sure how to capture and read each frame
>>> (wireshark speak) using Lnet.
>>>
>>> (FYI:
>>> http://en.wikipedia.org/wiki/Session_Initiation_Protocol#SIP_network_elements
>>> )
>>>
>>> For instance the following is from frame 12 (935 bytes)
>>>
>>> --
>>> INVITE sip:1...@192.168.91.200  SIP/2.0
>>> Via:SIP/2.0/UDP 192.168.91.190:5060;rport;branch=z9hG4bK83570061
>>> From:"Lloyd" 
>>> >;tag=4b428357-2fa-1ec5d4e
>>> To:>
>>> Contact:"Lloyd" 
>>> Call-ID:8357-4ce59...@192.168.91.200
>>> Subject:sip phone call
>>> CSeq:2112045024 INVITE
>>> User-Agent:Mitel-5212-SIP-Phone 07.02.00.04 08000F24BEE5
>>> Allow:INVITE,ACK,CANCEL,BYE,OPTIONS,REFER,NOTIFY,PRACK,UPDATE
>>> Allow-Events:talk,hold,conference
>>> Supported:timer,100rel,replaces
>>> Session-Expires: 1800
>>> Min-SE: 90
>>> Max-Forwards:70
>>> Content-Type:application/sdp
>>> Content-Length:247
>>>
>>> v=0
>>> o=1000 1262650963 1262650962 IN IP4 192.168.91.190
>>> s=SIP Call
>>> c=IN IP4 192.168.91.190
>>> t=0 0
>>> a=sendrecv
>>> m=audio 20036 RTP/AVP 0 8 18 96
>>> a=rtpmap:0 PCMU/8000
>>> a=rtpmap:8 PCMA/8000
>>> a=rtpmap:18 G729/8000
>>> a=rtpmap:96 telephone-event/8000
>>>
>>> ---
>>>
>>> I get a response from the sip server on frame 13 (371 bytes)
>>>
>>> --
>>> SIP/2.0 100 Trying
>>> Via: SIP/2.0/UDP 192.168.91.190:5060;rport=5060;branch=z9hG4bK83570061
>>> From: "Lloyd" 
>>> >;tag=4b428357-2fa-1ec5d4e
>>> To: >
>>> Call-ID: 8357-4ce59...@192.168.91.200
>>> CSeq: 2112045024 INVITE
>>> User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-15355M
>>> Content-Length: 0
>>>
>>> ---
>>>
>>>
>>>
>>>
>>> ___
>>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>>
>>
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-06 Thread lloyd thomas
Well I have made a start using someone elese libpcap inplementation, but
have bump into my first issue and because of my lack of skill I am not sure
how to code round it. Any Ideas?
I get the following errors

PlibCap\Pcap.pas(207,13) Error: Illegal qualifier
PlibCap\Pcap.pas(207,13) Hint: may be pointer dereference is missing
PlibCap\Pcap.pas(207,13) Fatal: Syntax error, "THEN" expected but
"identifier ADAPTER" found

In this section (so far)
 procedure CleanUp;
 begin
   if P.Adapter <> nil then PacketCloseAdapter(P.adapter); //error here
   if P.buffer<>nil then FreeMem(P.buffer,PcapBufSize); //but suspect I
would get one here as well
   Freemem(P,SizeOf(Tpcap));
 end,

(which I think has something to do with this)
type
  TWinVersion = (wv_WinS,
 wv_Win9x,  //Added by Lars Peter Christiansen.
 wv_WinNT,  //Eases the process of determing the
 wv_Win2000, //platform and do proper
instructions
 wv_WinXP,   //I.e : Char vs. WideChar issue
 wv_Unknown );



  PPcap_Stat = ^TPcap_stat;
  Tpcap_stat = record
ps_recv,  //* number of packets received */
ps_drop, //* number of packets dropped */
ps_ifdrop : LongWord;//* drops by interface not
supported */
  end;

  TPcap_sf = record  // Save file for offline reading.
rfile : HFILE;
swapped:integer;
version_major : integer;
Version_Minor : integer;
base : Pointer;
  end;

  TPcap_md = record
Stat : TPcap_stat;
use_bpf : integer;
TotPkts  : LongWord;   // Can owerflow after 79hours on
ethernet
TotAccepted:LongWord;  // accepted by filter/sniffer
TotDrops : LongWord;   // dropped packets
TotMissed: Longword;   // missed by i/f during this run
OrigMissed:LongWord;   // missed by i/f before this run
  end;

  PPcap_PktHdr = ^Tpcap_pkthdr;// Wrapped Drivers packetHeader
  TPcap_pkthdr = record
ts : TUnixTimeVal; // Time of capture
CapLen,// captured length
Len: Integer;  // actual length of packet
  end;

  PPcap = ^TPcap;  // THE MAIN INTERFACE HANDLE
  TPcap = record   // used with allmost all Pcap calls.
Adapter:Padapter;
Packet :PPacket;   // Global Driver packet. kind of a
buffer
snapshot:integer;
linktype:integer;  // Type and speed of net
tzoff   :integer;   // timezone offset
offset  :integer;
sf  :Tpcap_sf; // Save file
md  :Tpcap_md; // Diagnostics
//READ BUFFER
bufsize :integer;
buffer  :Pointer; //*u_char
bp  :Pointer; //*u_char
cc  :integer;
//Place holder for pcap_next().
pkt :Pointer; //*U_char
//Placeholder for filter code if bpf not in kernel.
fcode   :Tbpf_program;
errbuf  : array [0..PCAP_ERRBUF_SIZE-1] of char;  //Last error message
  end;


2010/1/5 ik 

> use libpcap (and bind it to FPC and share with us all :)) and then you can
> sniff packets (that's the easiest way I know).
>
>
> Ido
> http://ik.homelinux.org/
>
>
> On Tue, Jan 5, 2010 at 16:48, lloyd thomas wrote:
>
>> Also came across this which uses pcap, but seems to be delphi only
>> http://www.magsys.co.uk/delphi/magmonsock.asp
>>
>> is there something similar for fpc?
>>
>> 2010/1/5 lloyd thomas 
>>
>> OK. I wish to monitor and record calls between a SIP endpoint and SIP
>>> Gateway. At the moment I am doing that by connecting the SIP endpoint and my
>>> machine to an ethernet hub so that I can see all the traffic.
>>> In the first instance I just need to correctly capture, read and
>>> interprete the SIP messages so that I can make an informed decision which
>>> RDP packets to capture.
>>>
>>> Then I suppose I will have an even harder task capturing the RDP packets
>>> and joining both legs together (my coding skills is not great)!
>>>
>>> Lloydie T
>>>
>>> 2010/1/5 ik 
>>>
>>> Hello,
>>>>
>>>> SIP first of all uses UDP most of the times (and rarely TCP) .
>>>> It only create a tunnel that other protocols such as RDP and SDP are
>>>> going inside.
>>>>
>>>> Can you explain a bit more what exactly do you wish to implement (i'm
>>>> not sure that I understand) ?
>>>>
>>>> Ido
>>>>
>>>> http://ik.homelinux.org/
>>>>
>>>>
>>>> On Tue, Jan 5, 2

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-06 Thread lloyd thomas
No Joy, I get exactly the same error. But putting the following at the start
of the unit got me to the next error (which I managed to fix ptr = pointer)
{$ifdef FPC}
{$MODE delphi}
{$endif}


2010/1/6 ik 

> Try the following (see inline for the answer):
>
>
> On Wed, Jan 6, 2010 at 13:30, lloyd thomas wrote:
>
>> Well I have made a start using smeone elese libpcap inplementation, but
>> have bump into my first issue and because of my lack of skill I am not sure
>> how to code round it. Any Ideas?
>> I get the following errors
>>
>> PlibCap\Pcap.pas(207,13) Error: Illegal qualifier
>> PlibCap\Pcap.pas(207,13) Hint: may be pointer dereference is missing
>> PlibCap\Pcap.pas(207,13) Fatal: Syntax error, "THEN" expected but
>> "identifier ADAPTER" found
>>
>> In this section (so far)
>>  procedure CleanUp;
>>  begin
>>if P.Adapter <> nil then PacketCloseAdapter(P.adapter); //error
>> here
>>
>
> if Assigned(P.Adapter) then PacketCloseAdapter(P.adapter);
>
> if P.buffer<>nil then FreeMem(P.buffer,PcapBufSize); //but suspect
>> I would get one here as well
>>
> if Assigned(P.buffer) then FreeMem(P.buffer,PcapBufSize);
>
>
> The reason is that afaik assigned checks if the field is both nil and
> allocated, and if it's not nil but not allocated i will return false as
> well.
> Another thing is that I think you needed () around the comparing code.
>
>
>Freemem(P,SizeOf(Tpcap));
>>  end,
>>
>> (which I think has something to do with this)
>> type
>>   TWinVersion = (wv_WinS,
>>  wv_Win9x,  //Added by Lars Peter
>> Christiansen.
>>  wv_WinNT,  //Eases the process of determing
>> the
>>  wv_Win2000, //platform and do proper
>> instructions
>>  wv_WinXP,   //I.e : Char vs. WideChar issue
>>  wv_Unknown );
>>
>>
>>
>>   PPcap_Stat = ^TPcap_stat;
>>   Tpcap_stat = record
>> ps_recv,  //* number of packets received */
>> ps_drop, //* number of packets dropped */
>> ps_ifdrop : LongWord;//* drops by interface not
>> supported */
>>   end;
>>
>>   TPcap_sf = record  // Save file for offline reading.
>> rfile : HFILE;
>> swapped:integer;
>> version_major : integer;
>> Version_Minor : integer;
>> base : Pointer;
>>   end;
>>
>>   TPcap_md = record
>> Stat : TPcap_stat;
>> use_bpf : integer;
>> TotPkts  : LongWord;   // Can owerflow after 79hours on
>> ethernet
>> TotAccepted:LongWord;  // accepted by filter/sniffer
>> TotDrops : LongWord;   // dropped packets
>> TotMissed: Longword;   // missed by i/f during this run
>> OrigMissed:LongWord;   // missed by i/f before this run
>>   end;
>>
>>   PPcap_PktHdr = ^Tpcap_pkthdr;// Wrapped Drivers packetHeader
>>   TPcap_pkthdr = record
>> ts : TUnixTimeVal; // Time of capture
>> CapLen,// captured length
>> Len: Integer;  // actual length of packet
>>   end;
>>
>>   PPcap = ^TPcap;  // THE MAIN INTERFACE HANDLE
>>   TPcap = record   // used with allmost all Pcap
>> calls.
>> Adapter:Padapter;
>> Packet :PPacket;   // Global Driver packet. kind of a
>> buffer
>> snapshot:integer;
>> linktype:integer;  // Type and speed of net
>> tzoff   :integer;   // timezone offset
>> offset  :integer;
>> sf  :Tpcap_sf; // Save file
>> md  :Tpcap_md; // Diagnostics
>> //READ BUFFER
>> bufsize :integer;
>> buffer  :Pointer; //*u_char
>> bp  :Pointer; //*u_char
>> cc  :integer;
>> //Place holder for pcap_next().
>> pkt :Pointer; //*U_char
>> //Placeholder for filter code if bpf not in kernel.
>> fcode   :Tbpf_program;
>> errbuf  : array [0..PCAP_ERRBUF_SIZE-1] of char;  //Last error message
>>   end;
>>
>>
>> 2010/1/5 ik 
>>
>>> use libpcap (and bind it to FPC and share with us all :)) and then you
>>> can sniff packets (that's the easiest way I know).
>>>
&

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-06 Thread lloyd thomas
I have managed to get the zniffer wrapper to compile, but I am worried that
using {$MODE delphi} may not be the best way to produce optimized code.
Also I have seen other libpcap where they use ansichar instead of char. Is
there a reason for this?

function Pcap_getAdapternames(Delimiter:char;var ErrStr:string):string;
function Pcap_getAdapternames(Delimiter:AnsiChar;var ErrStr:string):string;


2010/1/6 lloyd thomas 

> No Joy, I get exactly the same error. But putting the following at the
> start of the unit got me to the next error (which I managed to fix ptr =
> pointer)
> {$ifdef FPC}
> {$MODE delphi}
> {$endif}
>
>
> 2010/1/6 ik 
>
>> Try the following (see inline for the answer):
>>
>>
>> On Wed, Jan 6, 2010 at 13:30, lloyd thomas wrote:
>>
>>> Well I have made a start using smeone elese libpcap inplementation, but
>>> have bump into my first issue and because of my lack of skill I am not sure
>>> how to code round it. Any Ideas?
>>>
>>> I get the following errors
>>>
>>> PlibCap\Pcap.pas(207,13) Error: Illegal qualifier
>>> PlibCap\Pcap.pas(207,13) Hint: may be pointer dereference is missing
>>> PlibCap\Pcap.pas(207,13) Fatal: Syntax error, "THEN" expected but
>>> "identifier ADAPTER" found
>>>
>>> In this section (so far)
>>>  procedure CleanUp;
>>>  begin
>>>if P.Adapter <> nil then PacketCloseAdapter(P.adapter); //error
>>> here
>>>
>>
>> if Assigned(P.Adapter) then PacketCloseAdapter(P.adapter);
>>
>> if P.buffer<>nil then FreeMem(P.buffer,PcapBufSize); //but suspect
>>> I would get one here as well
>>>
>> if Assigned(P.buffer) then FreeMem(P.buffer,PcapBufSize);
>>
>>
>> The reason is that afaik assigned checks if the field is both nil and
>> allocated, and if it's not nil but not allocated i will return false as
>> well.
>> Another thing is that I think you needed () around the comparing code.
>>
>>
>> Freemem(P,SizeOf(Tpcap));
>>>  end,
>>>
>>> (which I think has something to do with this)
>>> type
>>>   TWinVersion = (wv_WinS,
>>>  wv_Win9x,  //Added by Lars Peter
>>> Christiansen.
>>>  wv_WinNT,  //Eases the process of determing
>>> the
>>>  wv_Win2000, //platform and do proper
>>> instructions
>>>  wv_WinXP,   //I.e : Char vs. WideChar issue
>>>  wv_Unknown );
>>>
>>>
>>>
>>>   PPcap_Stat = ^TPcap_stat;
>>>   Tpcap_stat = record
>>> ps_recv,  //* number of packets received */
>>> ps_drop, //* number of packets dropped */
>>> ps_ifdrop : LongWord;//* drops by interface not
>>> supported */
>>>   end;
>>>
>>>   TPcap_sf = record  // Save file for offline
>>> reading.
>>> rfile : HFILE;
>>> swapped:integer;
>>> version_major : integer;
>>> Version_Minor : integer;
>>> base : Pointer;
>>>   end;
>>>
>>>   TPcap_md = record
>>> Stat : TPcap_stat;
>>> use_bpf : integer;
>>> TotPkts  : LongWord;   // Can owerflow after 79hours on
>>> ethernet
>>> TotAccepted:LongWord;  // accepted by filter/sniffer
>>> TotDrops : LongWord;   // dropped packets
>>> TotMissed: Longword;   // missed by i/f during this run
>>> OrigMissed:LongWord;   // missed by i/f before this run
>>>   end;
>>>
>>>   PPcap_PktHdr = ^Tpcap_pkthdr;// Wrapped Drivers packetHeader
>>>   TPcap_pkthdr = record
>>> ts : TUnixTimeVal; // Time of capture
>>> CapLen,// captured length
>>> Len: Integer;  // actual length of packet
>>>   end;
>>>
>>>   PPcap = ^TPcap;  // THE MAIN INTERFACE HANDLE
>>>   TPcap = record   // used with allmost all Pcap
>>> calls.
>>> Adapter:Padapter;
>>> Packet :PPacket;   // Global Driver packet. kind of a
>>> buffer
>>> snapshot:integer;
>>> linktype:integer;  // Type and speed of net
>>> tzoff

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-06 Thread lloyd thomas
OK I think I know the reason why 'ansichar'
Just did a bit of code to list the net adaptors in a combobox and All I get
is symbols (??? and ?...@?). I think I read somewhere Windows may save adaptor
names in unicode since windows 2000 (maybe).

procedure TForm1.FormCreate(Sender: TObject);
begin
Fzniffer := TZniffer.create;
   Combobox1.Items.assign(Fzniffer.Adapters);
end;



2010/1/6 Marco van de Voort 

> In our previous episode, lloyd thomas said:
> > I have managed to get the zniffer wrapper to compile, but I am worried
> that
> > using {$MODE delphi} may not be the best way to produce optimized code.
>
> No problem. fpc modes are mostly about syntax, not optimization. If the
> code
> is delphi in origin it is definitely the best solution.
>
> > Also I have seen other libpcap where they use ansichar instead of char.
> Is
> > there a reason for this?
>
> Yes, D2009 and later where char<>ansichar but char=widechar.
>
> IOW sb updated that piece for D2009+
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Help Reading SIP Messages.

2010-01-08 Thread lloyd thomas
Played around a bit, but realised the job was too much for me.
I have decided to use some of the tools readily available and execute them
when required.
tcpdump being one of the tools, if run with the *-c* flag, it will capture
packets until it is interrupted by a SIGINT or SIGTERM signal or the
specified number of packets have been processed.
Is there a way I can fork tcpdump as a seperate process and kill it when
required?

2010/1/6 lloyd thomas 

> OK I think I know the reason why 'ansichar'
> Just did a bit of code to list the net adaptors in a combobox and All I get
> is symbols (??? and ?...@?). I think I read somewhere Windows may save adaptor
> names in unicode since windows 2000 (maybe).
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
> Fzniffer := TZniffer.create;
>Combobox1.Items.assign(Fzniffer.Adapters);
> end;
>
>
>
> 2010/1/6 Marco van de Voort 
>
> In our previous episode, lloyd thomas said:
>> > I have managed to get the zniffer wrapper to compile, but I am worried
>> that
>> > using {$MODE delphi} may not be the best way to produce optimized code.
>>
>> No problem. fpc modes are mostly about syntax, not optimization. If the
>> code
>> is delphi in origin it is definitely the best solution.
>>
>> > Also I have seen other libpcap where they use ansichar instead of char.
>> Is
>> > there a reason for this?
>>
>> Yes, D2009 and later where char<>ansichar but char=widechar.
>>
>> IOW sb updated that piece for D2009+
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal