home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / COMMCDS.ZIP / COMMCDS.DOC next >
Encoding:
Text File  |  1993-01-04  |  19.7 KB  |  402 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                     COMMCDS UNIT
  10.  
  11.  
  12.                          A Turbo Pascal unit that implements
  13.                                 the Call Data Standard
  14.  
  15.                                      Version 0.90
  16.                                   by Rob Rosenberger
  17.                              CDS Development Team Leader
  18.  
  19.                              A public domain utility from
  20.                                   BARN OWL SOFTWARE
  21.                                      P.O. Box #74
  22.                                  O'Fallon, IL  62269
  23.                                  VOX: (618) 632-7345
  24.                                  BBS: (618) 398-5703
  25.                                  HST: (618) 398-2305
  26.                                  CIS:   74017,1344  
  27.  
  28.  
  29.                This unit, known as CommCDS, implements the functionality of
  30.           the powerful new Call Data Standard as it  applies  to communica-
  31.           tions programs and BBS  software.   Please read the CDS specs for
  32.           further information.  A copy of the specs is available  in Compu-
  33.           Serve's IBMCOM forum LIBrary 2, filename CDS.ARC.
  34.  
  35.                CDS defines standard methods for storing modem usage details
  36.           in a "Call History File."  This lets a class of programs known as
  37.           phone bill analyzers study the file to determine how much  a user
  38.           has spent in modem-related telephone calls.
  39.  
  40.                CDS goes beyond modem usage details.  It lets communications
  41.           programs "talk" to external protocol applications and  phone bill
  42.           analyzers.   A communications program could determine the cost of
  43.           the current call ── even if it's still in progress ── if the user
  44.           wants to know it.  (CommCDS v0.90 has not  yet  implemented  this
  45.           powerful feature.)
  46.  
  47.  
  48.                This unit requires the Turbo Professional  5.0  toolkit from
  49.           TurboPower Software.  Write to them for a free  brochure  if  you
  50.           don't already have this powerful toolkit.    TurboPower's address
  51.           is P.O. Box #66747, Scotts Valley, CA 95066-0747.
  52.  
  53.  
  54.           DEFINITIONS
  55.  
  56.  
  57.           ProgramName : STRING[08] = 'UNKNOWN';
  58.                Your communications program's name goes here in place of the
  59.           word "unknown".  You may use up to eight characters for the name.
  60.  
  61.                                   ── page 2 of 9 ──
  62.  
  63.  
  64.  
  65.           HostName    : STRING[16] = '';
  66.                If your communications program falls under the definition of
  67.           "navigation" software, then put your  host  service's  name here.
  68.           TAPCIS, for  example, would specify 'CompuServe'.  The max length
  69.           is 16 chars.  Leave this null if your comm program is for general
  70.           purpose communications.
  71.  
  72.           CDSProtocolType
  73.             = (UnknownProtocol,
  74.                NoProtocolUsed,
  75.                ASCII,
  76.                Bimodem,
  77.                CISA,
  78.                CISB,
  79.                CISQuickB,
  80.                CISBPlus,
  81.                Jmodem,
  82.                Kermit,
  83.                Modem7,
  84.                Telink,
  85.                Xmodem,
  86.                Xmodem1K,  {sometimes mistakenly referred to as Ymodem}
  87.                Xmodem1KG,
  88.                XmodemCRC,
  89.                Ymodem,    {the true Ymodem Batch protocol}
  90.                YmodemG,   {the true Ymodem Batch protocol}
  91.                Zmodem);
  92.                These protocols are currently "known" to CDS.
  93.  
  94.           ReasonType
  95.             = (UnknownReason,
  96.                BusinessReason,
  97.                PersonalReason);
  98.                CDS can tell when calls are placed specifically for business
  99.           or personal reasons.  Use the UnknownReason value if your program
  100.           doesn't know otherwise.
  101.  
  102.           CDSIORESULT : BYTE;
  103.                This variable always contains the IORESULT at the  end  of a
  104.           call to the CommCDS unit.  You must check it like you would check
  105.           IORESULT.  Unlike IORESULT, this variable retains its value after
  106.           studying it.
  107.  
  108.                                   ── page 3 of 9 ──
  109.  
  110.  
  111.  
  112.           ROUTINES
  113.  
  114.  
  115.           PROCEDURE ChangeCallParams(CommSpeed     : LONGINT;
  116.                                      CommBits      : BYTE;
  117.                                      CommParity    : CHAR;
  118.                                      CommStopBits  : BYTE;
  119.                                      CallerName    : STRING;
  120.                                      HostBBSName   : STRING;
  121.                                      SecurityLevel : INTEGER;
  122.                                      Comment       : STRING);
  123.  
  124.                This procedure lets you change the details about the call in
  125.           progress.  It is  extremely  useful when you switch baud rates or
  126.           change the security level of a caller.
  127.                CommSpeed, CommBits, CommParity, and CommStopBits combine to
  128.           produce the standard modem settings  for the call.  Good examples
  129.           would be "19200 8 N  1" or "1200 7 E 1".  The current values must
  130.           be supplied for each of these items; there is no default.
  131.                CallerName is either the name  of the person using your comm
  132.           program for an outgoing  call,  or the name of the person calling
  133.           into your BBS  program  for  an  incoming call.  This variable is
  134.           ignored if it contains a null string.
  135.                HostBBSName is the name of the system the  user  is calling.
  136.           It applies only to  outgoing  calls.  This variable is ignored if
  137.           it contains a null string.
  138.                SecurityLevel is  the current security level of the user who
  139.           has placed an incoming call.  The correct value must  be supplied
  140.           for this item; there is no default.
  141.                Comment  is any text you wish to add as a comment entry.  It
  142.           is truncated if it exceeds 56 characters.
  143.  
  144.  
  145.           PROCEDURE InitCommCDS(CDSPath : STRING);
  146.  
  147.                This procedure initializes the CommCDS unit.  You cannot use
  148.           any other routines in this unit  before  this one.  You MUST call
  149.           this procedure when your program first starts up.
  150.  
  151.                CDSPath provides a specific path where all CDS files will be
  152.           kept.   A null string means CDS files will be kept on the default
  153.           drive & directory.
  154.                CommCDS will hunt for old copies of its files and  append to
  155.           them if they exist.  Therefore, it would be to your  advantage to
  156.           provide a specific path instead of using a null string.
  157.  
  158.                                   ── page 4 of 9 ──
  159.  
  160.  
  161.  
  162.           PROCEDURE LogChargeChange(Suspend : BOOLEAN;
  163.                                     Comment : STRING);
  164.  
  165.                Networks such  as CompuServe and GEnie charge for their ser-
  166.           vices.  Yet they temporarily  suspend charges when a user uploads
  167.           a file or takes  advantage  of a special service.  CDS recognizes
  168.           this and accommodates for it.
  169.                This procedure suspends/resumes charges only for host system
  170.           charges.   CDS lets you suspend/resume phone company charges, but
  171.           few people will have a need to record such information.   You can
  172.           easily upgrade  this procedure to handle phone company charges as
  173.           well, if you need such a capability.
  174.  
  175.                Suspend dictates whether CommCDS should  temporarily suspend
  176.           charges.  True = suspend charges; false = resume charges.
  177.                Comment  is any text you wish to add as a comment entry.  It
  178.           is truncated if it exceeds 56 characters.
  179.  
  180.                                   ── page 5 of 9 ──
  181.  
  182.  
  183.  
  184.           PROCEDURE LogFileXfer(FileName          : STRING;
  185.                                 WasUploaded       : BOOLEAN;
  186.                                 FileSize          : LONGINT;
  187.                                 Reason4Transfer   : ReasonType;
  188.                                 Protocol          : CDSProtocolType;
  189.                                 SuspendBBSCharge  : BOOLEAN;
  190.                                 StartingDateTime  : DateTimeRec;
  191.                                 EndingDateTime    : DateTimeRec;
  192.                                 AbortedBySender   : BOOLEAN;
  193.                                 AbortedByRecvr    : BOOLEAN;
  194.                                 CallDiedInXfer    : BOOLEAN;
  195.                                 TotalXmitErrors   : WORD;
  196.                                 Efficiency        : REAL;
  197.                                 AverageCPS        : WORD;
  198.                                 Comment           : STRING);
  199.  
  200.                This routine logs details about transferred files in the CDS
  201.           Call History File.
  202.  
  203.                Filename is the name  of  the transferred file.  The path to
  204.           the file can be included, but it is not necessary.
  205.                WasUploaded is true if the file was uploaded,  false  if the
  206.           file was downloaded.
  207.                FileSize is the size of the file in bytes.
  208.                Reason4Transfer  dictates  whether  the file was transferred
  209.           for personal or business reasons, if such information is known.
  210.                Protocol describes the protocol used to transfer the file.
  211.                SuspendBBSCharge should be set  to  true  if the host system
  212.           suspended charges during this transfer.
  213.                StartingDateTime  and EndingDateTime tell when the  transfer
  214.           began and ended.  DateTimeRec is defined in TPRO5's TpDate unit.
  215.                AbortedBySender is  true only if the sender aborted the file
  216.           transfer before completion.
  217.                AbortedByRecvr is true only if the receiver aborted the file
  218.           transfer before completion.
  219.                CallDiedInXfer is true only if the connection was lost while
  220.           the file was being transmitted.
  221.                TotalXmitErrors  contains the number of erroneous blocks  of
  222.           data discovered during the file transfer.
  223.                Efficiency contains a (real) number describing how efficient
  224.           the transfer was.  Efficiency = 96.4 if a file transfer was 96.4%
  225.           efficient.  Efficiency is ignored if it is 0.0.
  226.                AverageCPS contains the average characters per second trans-
  227.           mitted during the file transfer.  AverageCPS is ignored if  it is
  228.           zero.
  229.                Comment  is any text you wish to add as a comment entry.  It
  230.           is truncated if it exceeds 56 characters.
  231.  
  232.                                   ── page 6 of 9 ──
  233.  
  234.  
  235.  
  236.           PROCEDURE LogForumSwitch(ForumName : STRING;
  237.                                    Comment   : STRING);
  238.  
  239.                This routine logs a CDS entry that shows  the  user switched
  240.           to a different forum, or area, of the host system.   For example,
  241.           CompuServe  users  can  switch from the TAPCIS forum to the LOTUS
  242.           forum, and PCBoard users can switch from the  MAIN  conference to
  243.           the PROGRAMS conference.
  244.                CDS methodology  dictates you first show a user entered some
  245.           sort of "main" forum.  The time spent getting to the "main" forum
  246.           is then considered to be the natural overhead of logging onto the
  247.           system.
  248.                You should use this routine  only if you keep accurate track
  249.           of where users go within the host system.
  250.  
  251.                ForumName is the name of  the forum (or conference) the user
  252.           is accessing.  The forum name will be truncated to 16 characters.
  253.                Comment  is any text you wish to add as a comment entry.  It
  254.           is truncated if it exceeds 56 characters.
  255.  
  256.  
  257.           PROCEDURE LogFreeFormatComment(CommentString : STRING);
  258.  
  259.                This  procedure puts a comment of ANY  length  in  the  Call
  260.           History file.
  261.                NOTE: This procedure works different from all  other CommCDS
  262.           procedures.  There is only one CommentString variable ── however,
  263.           you may call this procedure as many times as it takes to store an
  264.           entire comment.  The only  requirement is that you MUST terminate
  265.           the comment by calling  this  procedure with a null string.  This
  266.           signals you are finished with your free-format comment.
  267.                Comments are automatically tied to a phone call if a call is
  268.           in progress. Otherwise it is written to the Call History  File as
  269.           a 'generic' comment.
  270.                CDSIORESULT is initialized after you finish the comment.  Do
  271.           not bother to check it until you call this procedure with  a null
  272.           string.
  273.  
  274.                CommentString can be any length up to the max 255 characters
  275.           imposed by Turbo Pascal.  Word-wrapping is performed if necessary
  276.           to make CommentString fit within CDS constraints.  A new  line is
  277.           started when the entire CommentString has been stored in the Call
  278.           History File.  Please be aware of this if you want to format each
  279.           string when it goes into the CDS comment record.
  280.  
  281.                                   ── page 7 of 9 ──
  282.  
  283.  
  284.  
  285.           PROCEDURE LogIncomingCall(CommPort      : INTEGER;
  286.                                     CommSpeed     : LONGINT;
  287.                                     CommBits      : BYTE;
  288.                                     CommParity    : CHAR;
  289.                                     CommStopBits  : BYTE;
  290.                                     CallerName    : STRING;
  291.                                     SecurityLevel : INTEGER;
  292.                                     LocalLogon    : BOOLEAN;
  293.                                     Comment       : STRING);
  294.  
  295.                This  procedure  logs  an incoming call.  This is common for
  296.           BBS applications  as well as communications programs that offer a
  297.           limited host mode service.
  298.  
  299.                CommPort is the numeric port designator handling  this call.
  300.           COM1 is 1, COM2 is 2, and so forth.  This value MUST be supplied.
  301.           The reason will become obvious if you study the CDS specs.
  302.                CommSpeed, CommBits, CommParity, and CommStopBits combine to
  303.           produce the standard modem settings  for the call.  Good examples
  304.           would be "19200 8 N  1" or "1200 7 E 1".  The current values must
  305.           be supplied for each of these items; there is no default.
  306.                CallerName is the name of the caller.  Use "SYSOP"  when the
  307.           system operator is logging into the host system.
  308.                Securitylevel is the security level of the caller.
  309.                LocalLogon is true only when  the caller is logging onto the
  310.           host system from a local terminal.
  311.                Comment  is any text you wish to add as a comment entry.  It
  312.           is truncated if it exceeds 56 characters.
  313.  
  314.                                   ── page 8 of 9 ──
  315.  
  316.  
  317.  
  318.           PROCEDURE LogOutgoingCall(CommPort     : INTEGER;
  319.                                     CommSpeed    : LONGINT;
  320.                                     CommBits     : BYTE;
  321.                                     CommParity   : CHAR;
  322.                                     CommStopBits : BYTE;
  323.                                     CallerName   : STRING;
  324.                                     Reason4Call  : ReasonType;
  325.                                     HostBBSName  : STRING;
  326.                                     PhoneNumber  : STRING;
  327.                                     HostCallback : BOOLEAN;
  328.                                     Comment      : STRING);
  329.  
  330.                This  procedure  logs  an outgoing call.  This is common for
  331.           communications programs, and for BBS applications (and communica-
  332.           tions programs) that offer a security callback feature.
  333.  
  334.                CommPort is the numeric port designator handling  this call.
  335.           COM1 is 1, COM2 is 2, and so forth.  This value MUST be supplied.
  336.           The reason will become obvious if you study the CDS specs.
  337.                CommSpeed, CommBits, CommParity, and CommStopBits combine to
  338.           produce the standard modem settings  for the call.  Good examples
  339.           would be "19200 8 N  1" or "1200 7 E 1".  The current values must
  340.           be supplied for each of these items; there is no default.
  341.                CallerName is the name or userID of the  person  making this
  342.           outgoing  call  (if  known).  In cases of security callbacks, you
  343.           might want to say the caller was "Security Callback Mode".   This
  344.           item is ignored if it is a null string.
  345.                Reason4Call dictates  if the call was placed for personal or
  346.           business reasons, if such information is known.
  347.                HostBBSName can be a little confusing.  If this is a regular
  348.           outgoing call, the user has dialed either a BBS or a network like
  349.           CompuServe.  Obviously then, HostBBSName contains the name of the
  350.           host system.  But if it is a security callback  call, HostBBSName
  351.           contains the name of the  user.  ...HostBBSName is usually known,
  352.           but  there are some exceptions.  You won't know the name of a BBS
  353.           when the user performs a manual dial, so use "UNKNOWN" (all caps)
  354.           for the name.   The same holds true if you detect a call when the
  355.           program first loads into memory.
  356.                PhoneNumber obviously contains the phone number.  If this is
  357.           a null string, it means you don't know what the phone number was.
  358.           This could be due to a user typing an AT dialing command directly
  359.           to the modem, or if a call was in progress when the program first
  360.           loaded in  memory.  NOTE: Vanity numbers such as "1-800-DEC-DEMO"
  361.           are not allowed.   You  MUST convert it to its equivalent numeric
  362.           form.  CDS phone bill analyzers view letters in the  phone number
  363.           as redefinable prefix/suffix codes.    Consult  the CDS specs for
  364.           further information.
  365.                HostCallback is  true only if a security callback feature is
  366.           making the outgoing call.
  367.                Comment  is any text you wish to add as a comment entry.  It
  368.           is truncated if it exceeds 56 characters.
  369.  
  370.                                   ── page 9 of 9 ──
  371.  
  372.  
  373.  
  374.           PROCEDURE LogTerminatedCall(PasswordFailure : BOOLEAN;
  375.                                       CallContinuedOn : BOOLEAN;
  376.                                       CallEndedAbrupt : BOOLEAN;
  377.                                       AverageCPS      : WORD;
  378.                                       Comment         : STRING);
  379.  
  380.                This procedure logs the termination of a call.    It applies
  381.           to both incoming and outgoing calls.
  382.  
  383.                PasswordFailure is true only if the (incoming) call was ter-
  384.           minated due to excessive password failures.
  385.                CallContinuedOn is true only if the current call in progress
  386.           remained active after the communications program terminated.   If
  387.           you leave DTR up upon termination, you MUST  call  this procedure
  388.           and set set CallContinuedOn to true.
  389.                CallEndedAbrupt is true only if the modem dropped connection
  390.           without warning.
  391.                AverageCPS contains the average characters per second trans-
  392.           mitted during the call.  AverageCPS is ignored if it is zero.
  393.                Comment  is any text you wish to add as a comment entry.  It
  394.           is truncated if it exceeds 56 characters.
  395.  
  396.  
  397.           PROCEDURE WrapupCommCDS;
  398.  
  399.                This  procedure  wraps  up the CommCDS unit.  You cannot use
  400.           any  other  routines  in this unit after this one.  You MUST call
  401.           this procedure when your program terminates.
  402.