home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / packet / bb211 / internal.doc < prev    next >
Text File  |  1991-03-03  |  23KB  |  383 lines

  1. This file contains documentation of file layouts.  Its intended for for
  2. programmers trying to write servers etc.
  3.  
  4. When writing a server, try to keep to using IMPORT and EXPORT for
  5. getting messages in and out of the BBS.  This will allow you to contiue
  6. to run even after I change the file formats.
  7.  
  8. General types used elsewhere
  9. ----------------------------
  10.  
  11. CONST
  12.   call_sign_len = 6;
  13.   bb_addr_len   = 10;
  14.   h_addr_len    = 32;
  15.   bid_len       = 12;
  16.   password_len  = 8;
  17.   file_name_len = 80;
  18.   subj_len      = 128;
  19.  
  20. TYPE
  21.  
  22.   bb_addr_str   = STRING[bb_addr_len];
  23.   bb_full_addr  = STRING[call_sign_len + 1 + h_addr_len];
  24.   bid_str       = STRING[bid_len];
  25.   call_sign_str = STRING[call_sign_len];
  26.   file_name_str = STRING[file_name_len];
  27.   h_addr_str    = STRING[h_addr_len];
  28.   password_str  = STRING[password_len];
  29.   subj_str      = STRING[subj_len];
  30.  
  31.  
  32. MSG.BB
  33. ------
  34.  
  35. The file contains either one of two records per message.  The second
  36. record is needed to hold the distribution list.  The first record is garbage
  37. except for the record number.  That number is the version number of the file.
  38. It should be "2"
  39.  
  40. CONST
  41.  
  42.      msg_dist_max = 20;                 (* Max number of distribution list   *)
  43.      msg_path_max_msgs = 254;           (* Max messages per path.  Don't     *)
  44.                                         (* exceed 254.                       *)
  45.      msg_path_max_route = 30;           (* Max routes per path.  Don't exceed*)
  46.                                         (* 254                               *)
  47.  
  48. (*---------------------------------------------------------------------------*)
  49. (* These define bits in msg_d_flag                                           *)
  50. (*---------------------------------------------------------------------------*)
  51.  
  52. CONST
  53.   df_fwd         = $01;         (* Message has been forwarded                *)
  54.   df_fwd_select  = $02;         (* Message has been selected for forward     *)
  55.   df_fwd_process = $04;         (* Forward in process now                    *)
  56.   df_fwd_reject  = $08;         (* Bid was rejected                          *)
  57.   df_fwd_cancel  = $10;         (* Forward was cancelled by operator         *)
  58.   df_fwd_unknown = $20;         (* Unknown route                             *)
  59.  
  60. (*---------------------------------------------------------------------------*)
  61. (* These define bits in msg_flag                                             *)
  62. (*---------------------------------------------------------------------------*)
  63.  
  64. CONST
  65.  
  66.   mf_hold         = $0001;      (* Message is in hold                        *)
  67.   mf_read         = $0002;      (* Message has been read                     *)
  68.   mf_fwd          = $0004;      (* Message has been forwarded                *)
  69.   mf_fwd_select   = $0008;      (* Message has been selected for fwd         *)
  70.   mf_fwd_list     = $0010;      (* Distribution list attached                *)
  71.   mf_old          = $0020;      (* Message is old                            *)
  72.   mf_kill         = $0040;      (* Message has been killed                   *)
  73.   mf_fwd_process  = $0080;      (* Forward in process now                    *)
  74.   mf_review       = $0100;      (* Message for review by SYSOP               *)
  75.   mf_h_receive    = $0200;      (* Hierarchial route received                *)
  76.   mf_archive      = $2000;      (* Msg has been archived                     *)
  77.   mf_disrout      = $4000;      (* Distribution routing block present        *)
  78.   mf_unknown      = $8000;      (* Routed to ?                               *)
  79.  
  80. (*---------------------------------------------------------------------------*)
  81. (* Types                                                                     *)
  82. (*---------------------------------------------------------------------------*)
  83.  
  84. TYPE
  85.     msg_flag_type = WORD;
  86.  
  87.     (* ----- This is the individual distribution list entries ------------- *)
  88.  
  89.     msg_dist_entry_type = RECORD
  90.               msg_d_flag    : BYTE;         (* Flags for this item          *)
  91.               msg_d_info    : bb_addr_str;  (* Where to forward to          *)
  92.             END;
  93.  
  94.     msg_dist_block_type = RECORD
  95.               msg_d_no      : BYTE;         (* No of items                  *)
  96.               msg_d_array   : ARRAY[1..msg_dist_max] OF msg_dist_entry_type;
  97.             END;
  98.  
  99.     (* ----- This is the file format -------------------------------------- *)
  100.  
  101.  
  102.     msg_block = RECORD
  103.               msg_number  : WORD;           (* This msg number               *)
  104.               msg_type    : CHAR;           (* Type of msg -- list is below  *)
  105.               msg_flag    : msg_flag_type;  (* Flags                         *)
  106.               msg_size    : LONGINT;        (* Message size                  *)
  107.               msg_to      : call_sign_str;  (* To addressee                  *)
  108.               msg_to_at   : bb_addr_str;    (* To mailbox address            *)
  109.               msg_to_h    : h_addr_str;     (* To hierarchial route          *)
  110.               msg_from    : call_sign_str;  (* From                          *)
  111.               msg_from_at : bb_addr_str;    (* From mailbox                  *)
  112.               msg_from_h  : h_addr_str;     (* From hierarchial route        *)
  113.               msg_dt_in   : LONGINT;        (* Message's date time at here   *)
  114.               msg_dt_orig : LONGINT;        (* Message's date time at origin *)
  115.               msg_no_orig : WORD;           (* Message number at origin      *)
  116.               msg_tread   : BYTE;           (* Times read (except sysops)    *)
  117.               msg_bid     : bid_str;        (* Message bid                   *)
  118.               msg_r_call  : call_sign_str;  (* Call sign of reject station   *)
  119.               msg_reason  : BYTE;           (* Reason for hold/review        *)
  120.               msg_subj    : subj_str;       (* Subject                       *)
  121.             END;
  122.  
  123.  
  124. USER.BB
  125. -------
  126.  
  127. The file contains one record per user.  The first record is garbage
  128. except for the first word.  That number is the version number of the
  129. file.  It should be "2"
  130.  
  131. (*---------------------------------------------------------------------------*)
  132. (* These define bits in user_flag                                            *)
  133. (*---------------------------------------------------------------------------*)
  134.  
  135. CONST
  136.  
  137.   user_f_trans    = $0001;     (* User is transparent                        *)
  138.   user_f_bbs      = $0002;     (* User is a BBS                              *)
  139.   user_f_abbs     = $0004;     (* User is an advanced BBS                    *)
  140.   user_f_sysop    = $0008;     (* User can be a remote sysop                 *)
  141.   user_f_adrchg   = $0010;     (* User has updated his home BBS              *)
  142.   user_f_exclude  = $0020;     (* User is excluded                           *)
  143.   user_f_delete   = $0040;     (* User record is empty                       *)
  144.   user_f_local    = $0080;     (* User is a local                            *)
  145.   user_f_emerg    = $4000;     (* User is allowed on during emergencies      *)
  146.   user_f_pbbs     = $8000;     (* User is a personal BBS                     *)
  147.  
  148. TYPE
  149.     user_class_type =
  150.                      (user_c_nu,         (* New user                         *)
  151.                       user_c_uu,         (* Unregistered user                *)
  152.                       user_c_ou,         (* Old user                         *)
  153.                       user_c_eu,         (* Expert user                      *)
  154.                       user_c_bu,         (* BBS user                         *)
  155.                       user_c_rsu,        (* Remote sysop user                *)
  156.                       user_c_lsu);       (* Local sysop user                 *)
  157.  
  158.     user_record_type = RECORD
  159.                          user_i_ptr  : user_index_ptr;  (* Pointer to index  *)
  160.                          user_id     : call_sign_str;   (* Call sign of user *)
  161.                          user_ssid   : ssid_sign_str;   (* SSID of user      *)
  162.                          user_name   : STRING[20];      (* User's name       *)
  163.                          user_bbs    : bb_addr_str;     (* Mail address      *)
  164.                          user_zip    : STRING[10];      (* Zip code          *)
  165.                          user_port   : CHAR;            (* User's port       *)
  166.                          user_class  : user_class_type; (* User class        *)
  167.                          user_flag   : WORD;            (* User flags        *)
  168.                          user_fmt    : BYTE;            (* Format of "L"     *)
  169.                          max_pac     : WORD;            (* Maximum packet siz*)
  170.                          user_last   : LONGINT;         (* Last time on      *)
  171.                          user_l_time : LONGINT;         (* Last time "L" done*)
  172.                          user_l_cnt  : WORD;            (* Number of logons  *)
  173.                          user_n_time : LONGINT;         (* Last time "N" done*)
  174.                          user_pw     : password_str;    (* Password          *)
  175.                          user_sysop_p: BYTE;            (* SYSOP password #  *)
  176.                          user_lang   : CHAR;            (* User language     *)
  177.                          user_scr_len: BYTE;            (* Length of user's  *)
  178.                                                         (*      screen       *)
  179.                          user_scr_wid: BYTE;            (* Width of user's   *)
  180.                                                         (*      screen       *)
  181.                          padding     : ARRAY[1..5] OF BYTE;
  182.                        END;
  183.  
  184.  
  185. BBOPT.BB
  186. --------
  187.  
  188. This file contains the options information.  The first record is the
  189. main option block followed by the port blocks and then the file blocks.
  190. Each record is 4096 bytes long.  This file changes format a lot but
  191. the file control blocks have been fairly constant.
  192.  
  193. --- First block ---
  194.  
  195.   opt_type = RECORD
  196.  
  197.         port_count         : BYTE;      (* Number of ports                   *)
  198.         fd_count           : BYTE;      (* Number of file directories        *)
  199.  
  200.         opt_type_bpt       : BOOLEAN;   (*  Limit types to B, P, and T       *)
  201.         opt_sysop_is_in    : BOOLEAN;   (* Sysop is accepting calls          *)
  202.         opt_sysop_bell     : BOOLEAN;   (* Sysop bell is on                  *)
  203.         opt_bid_for_p      : BOOLEAN;   (* Gen BID for P messages            *)
  204.         opt_bid_for_t      : BOOLEAN;   (* Gen BID for T messages            *)
  205.         opt_bid_for_blank  : BOOLEAN;   (* Gen BID for _ messages            *)
  206.         opt_blank_to_p     : BOOLEAN;   (* Translate "S" to "SP"             *)
  207.         opt_blank_to_b     : BOOLEAN;   (* Translate "S" to "SB"             *)
  208.         opt_hold_dupe_bid  : BOOLEAN;   (* Hold duplicate bids               *)
  209.         opt_kill_bbs_error : BOOLEAN;   (* Disconnect BBS on any error       *)
  210.         opt_direct_display : BOOLEAN;   (* Write direct to display           *)
  211.         opt_direct_snow    : BOOLEAN;   (* Avoid snow on CGA                 *)
  212.         opt_rename_k       : BOOLEAN;   (* Rename killed                     *)
  213.         opt_error          : BOOLEAN;   (* Log minor errors                  *)
  214.         opt_mono_tcb_trace : BOOLEAN;   (* Special monochrome TCB trace      *)
  215.         opt_trace          : BOOLEAN;   (* Run trace                         *)
  216.         opt_mon_time_stamp : BOOLEAN;   (* Time stamp monitor data           *)
  217.         opt_bbs_see_p      : BOOLEAN;   (* Allow BBS to see "P" messages     *)
  218.         opt_already_conn   : BOOLEAN;   (* Duplicate connect check           *)
  219.         opt_time_status    : BOOLEAN;   (* Update status line on time tick   *)
  220.         opt_own_in_bcst    : BOOLEAN;   (* Own call in BCST                  *)
  221.         opt_yapp_state     : BOOLEAN;   (* Show YAPP states                  *)
  222.         opt_show_binary    : BOOLEAN;   (* Show binary data during s/r       *)
  223.         opt_suppress_pfx   : BOOLEAN;   (* Don't show prefix on LO screen    *)
  224.         opt_show_mismatch  : BOOLEAN;   (* Show mismatch during forward scrpt*)
  225.         opt_auto_hlookup   : BOOLEAN;   (* Do HLOOKUP each forward cycle     *)
  226.         opt_extend_timeout : BOOLEAN;   (* Extend timeout on ports           *)
  227.         opt_personal_bbs   : BOOLEAN;   (* Personal BBS                      *)
  228.         opt_no_alt_header  : BOOLEAN;   (* Alternate header                  *)
  229.         opt_send_sid_alwys : BOOLEAN;   (* Always send SID                   *)
  230.         opt_fill_blank_bbs : BOOLEAN;   (* If @ BBS is blank fill from user  *)
  231.         opt_no_lang_prompt : BOOLEAN;   (* Language prompt control in registr*)
  232.         opt_blank_to_bbs   : BOOLEAN;   (* If on, set the default to bbs = ''*)
  233.         opt_autoset_to_bbs : BOOLEAN;   (* If on, set the default to bbs to  *)
  234.                                         (* that user's home BBS if any       *)
  235.  
  236.         operate_mode  : op_mode;        (* Operation mode                    *)
  237.         max_task_no   : BYTE;           (* Maximum number of tasks           *)
  238.         this_bb_sign  : call_sign_str;  (* Call sign of BBS                  *)
  239.         this_bb_bid   : call_sign_str;  (* Call sign of BBS for bid purposes *)
  240.         sysop_sign    : call_sign_str;  (* Call sign of SYSOP                *)
  241.         this_bb_addr  : bb_addr_str;    (* Address of BBS                    *)
  242.         this_bb_h     : h_addr_str;     (* Hieararchical addess of this BBS  *)
  243.         this_bb_name  : STRING[15];     (* SYSOP name                        *)
  244.         this_bb_loc   : STRING[25];     (* Location                          *)
  245.         user_file_name: file_name_str;  (* USER control file                 *)
  246.         msg_file_name : file_name_str;  (* MSG control file                  *)
  247.         msg_file_dir  : file_name_str;  (* Directory for the msg files       *)
  248.         mess_fn       : file_name_str;  (* File name for messages            *)
  249.         dos_mess_fn   : file_name_str;  (* File name for DOS messages        *)
  250.         route_fn      : file_name_str;  (* File name for route table         *)
  251.         path_fn       : file_name_str;  (* File name for path table          *)
  252.         log_fn        : file_name_str;  (* File name for log                 *)
  253.         help_fn       : file_name_str;  (* File name for help                *)
  254.         doserr_fn     : file_name_str;  (* File name for DOS error messages  *)
  255.         mon_fn        : file_name_str;  (* File name for monitor log         *)
  256.         wakeup_fn     : file_name_str;  (* File name for wakeup              *)
  257.         hlook_fn      : file_name_str;  (* File name for hlookup             *)
  258.         sysop_fn      : file_name_str;  (* File name for SYSOP password      *)
  259.         action_fn     : file_name_str;  (* File name for action file         *)
  260.         n_mon         : WORD;           (* Number of mon items to keep       *)
  261.         bid_fn        : file_name_str;  (* File name for bid table           *)
  262.         n_bid         : WORD;           (* Number of bid items to keep       *)
  263.         n_j_list      : BYTE;           (* Number of items on j list         *)
  264.         hold_dupe_hdr : BYTE;           (* Number of dup headers to hold     *)
  265.         trace_file_name : file_name_str;  (* Trace output                    *)
  266.         z_time_bbs    : LONGINT;        (* Timezone correction -- BBS        *)
  267.         z_time_fwd    : LONGINT;        (* Timezone correction -- FWD        *)
  268.         nofwd_kill    : STRING[26];     (* Dont kill on forward              *)
  269.         bcst_interval : BYTE;           (* Broadcast interval in minutes     *)
  270.         disc_delay    : BYTE;           (* Disconnect delay                  *)
  271.         fwd_delay     : BYTE;           (* Forward delay                     *)
  272.         opt_types     : STRING[27];     (* Allowed types                     *)
  273.         emer_types    : STRING[27];     (* Emergency types                   *)
  274.         operator_color: BYTE;           (* Color of operator stuff           *)
  275.         status_color  : BYTE;           (* Color of staus line               *)
  276.         window_percent: BYTE;           (* Window split percentage           *)
  277.         scroll_mon    : WORD;           (* Monitor scroll                    *)
  278.         scroll_opr    : WORD;           (* Operator scroll                   *)
  279.         scroll_conn   : WORD;           (* Connect scroll                    *)
  280.         editor_free   : WORD;           (* Editor free size                  *)
  281.         bell_length1  : BYTE;           (* Tone length                       *)
  282.         bell_length2  : BYTE;           (* Warble length                     *)
  283.         max_headers   : BYTE;           (* Maximum number of headers         *)
  284.         newuser_l_time: BYTE;           (* Maximum number of headers         *)
  285.         wp_bb_sign    : bb_full_addr;   (* Call sign of WP system to send to *)
  286.         home_expires  : LONGINT;        (* When Home BBS expires             *)
  287.         b_fwd_stop    : LONGINT;        (* Don't forward bulletins after     *)
  288.                                         (* this time period                  *)
  289.         dflt_b_expire : LONGINT;        (* Default bulletin expiration date  *)
  290.         language_list : lang_str;       (* List of allowed languages         *)
  291.  
  292.         parm_file_ver : BYTE;           (* Version number of parm file       *)
  293.  
  294.       END;
  295.  
  296. --- Port block ---
  297.  
  298.     port_block_type = RECORD
  299.                         next_port   : port_block_ptr;   (* -> next block     *)
  300.                         main_port   : port_block_ptr;   (* -> main port      *)
  301.                         rel_port    : port_block_ptr;   (* -> related port   *)
  302.                         aux_thread  : tcb_ptr;          (* Monitor thread    *)
  303.                         com_number  : BYTE;             (* COMx number       *)
  304.                         port_char   : CHAR;             (* Character for port*)
  305.                         port_name   : STRING[20];       (* Name of port      *)
  306.                         port_type   : port_type_type;   (* Port type         *)
  307.  
  308.                         port_host_only      : BOOLEAN;  (* Host mode only tnc*)
  309.                         port_sub_port       : BOOLEAN;  (* Sub port (PC*PA)  *)
  310.                         port_monitor        : BOOLEAN;  (* Monitor this port?*)
  311.                         port_r_sysop        : BOOLEAN;  (* Remote sysop ok   *)
  312.                         port_up_down        : BOOLEAN;  (* Upload/Download ok*)
  313.                         port_bcst           : BOOLEAN;  (* Bcst on this port *)
  314.                         port_pk232_data_ack : BOOLEAN;  (* PK232 dat ack wait*)
  315.                         port_no_out_fwd     : BOOLEAN;  (* No outgoing fwd   *)
  316.                         port_no_busy_fwd    : BOOLEAN;  (* No outgoing fwd   *)
  317.                                                         (* when busy         *)
  318.                         port_no_binary      : BOOLEAN;  (* No binary allowed *)
  319.                         port_use_user_chan  : BOOLEAN;  (* User user channel *)
  320.                                                         (* for forwarding    *)
  321.                         port_dflt_trans     : BOOLEAN;  (* Default transpart *)
  322.  
  323.  
  324.                         port_operate_mode : op_mode;    (* Operation mode    *)
  325.                         port_num    : CHAR;             (* PCPA port #       *)
  326.                         port_color  : BYTE;             (* Display color     *)
  327.                         port_sema   : BYTE;             (* Semaphore number  *)
  328.                         port_allow  : user_class_type;  (* Allow this class  *)
  329.                         dflt_pac    : WORD;             (* Default packet siz*)
  330.                         max_pac     : WORD;             (* Max packet size   *)
  331.                         data_rate   : WORD;             (* Data rate to use  *)
  332.                         time_out    : WORD;             (* Time out in second*)
  333.                         fwd_min     : WORD;             (* Forward minute    *)
  334.                         sked_fwd    : LONGINT;          (* Next time to fwd  *)
  335.                         max_conn    : BYTE;             (* Num of connects   *)
  336.                         max_chan    : BYTE;             (* Max capacity TNC  *)
  337.                         port_pend   : BYTE;             (* Maximum port pend *)
  338.                         dflt_scrl   : BYTE;             (* Default screen len*)
  339.                         reject_act  : BYTE;             (* Reject action     *)
  340.                         dflt_lang   : CHAR;             (* Default language  *)
  341.                         first_load  : file_name_str;    (* File to load      *)
  342.                         dflt_order  : STRING[3];        (* Default fwd order *)
  343.                         connected   : port_connect_ptr; (* List of connects  *)
  344.                         call_list   : port_call_ptr;    (* list of calls hrd *)
  345.                         CASE BYTE OF
  346.  
  347.                           0 :                           (* All ports but modm*)
  348.                               (call_set  : STRING[9];   (* Set this call     *)
  349.                                bcst_path : STRING[45]); (* Bcst this path    *)
  350.  
  351.                           1:                            (* Modem ports       *)
  352.                               (modem_optns : BYTE;      (* Signify modem opt *)
  353.                                answer_ring : BYTE;      (* Answer on this rin*)
  354.                                cr_timeout  : BYTE;      (* CR time out       *)
  355.                                cur_rate    : WORD;      (* Current data rate *)
  356.                                modem_echo  : BOOLEAN;   (* Echo on modem     *)
  357.                                modem_e_now : BOOLEAN;   (* Echo on modem NOW *)
  358.                                modem_crlf  : BOOLEAN;   (* CR=CR/LF for modem*)
  359.                                modem_dial  : BOOLEAN;   (* Modem dialing     *)
  360.                                modem_conn  : BOOLEAN;   (* Modem connect msg *)
  361.                                port_modem_dcd : BOOLEAN); (* DCD on modem    *)
  362.  
  363.                       END;
  364.  
  365. --- File block ---
  366.  
  367.   TYPE
  368.     fsb_name_str          = STRING[10];
  369.  
  370.     fsb_ptr               = ^file_subsys_block;
  371.  
  372.     file_subsys_block     = RECORD
  373.                               next_fsb        : fsb_ptr;
  374.                               fsb_name        : fsb_name_str;
  375.                               fsb_alias       : STRING[60];
  376.                               fsb_desc        : STRING[60];
  377.                               fsb_path        : file_name_str;
  378.                               fsb_f_subdir_ok : BOOLEAN;
  379.                               fsb_binary      : BOOLEAN;
  380.                               fsb_up          : user_class_type;
  381.                               fsb_down        : user_class_type;
  382.                             END;
  383.