home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / comms / misc / rf911215.lha / work_detail.h < prev   
C/C++ Source or Header  |  1991-11-30  |  6KB  |  166 lines

  1. /*
  2.  *  Structures for what files are sent/received.
  3.  */
  4.  
  5. /* Get OS stuff! */
  6. #ifndef _WORK_DETAIL_
  7.  
  8. #ifndef EXEC_TYPES_H
  9. #include <exec/types.h>
  10. #endif
  11.  
  12. #ifndef EXEC_LISTS_H
  13. #include <exec/nodes.h>
  14. #endif
  15. #ifndef EXEC_LISTS_H
  16. #include <exec/lists.h>
  17. #endif
  18.  
  19. #ifndef EXEC_SEMAPHORE_H
  20. #include <exec/semaphores.h>
  21. #endif
  22.  
  23. #ifndef _SITE_H_
  24. #include "site.h"
  25. #endif
  26.  
  27. /* Note: following structure is backward compatible. Thus the strange ordering */
  28.  
  29. typedef struct work_detail_node {
  30.   struct Node dt_node;
  31.   LONG dt_length;      /* length of Detail structure! */
  32.   unsigned char  dt_flags;
  33.   unsigned char  dt_status;
  34.   unsigned short dt_time;
  35.   signed char  dt_minPri;    /* No longer used!!!! */
  36.   signed char  dt_maxPri;    /* Priority to send file */
  37. #define dt_minCost  dt_minPri
  38. #define dt_maxCost  dt_maxPri
  39. #define dt_cost     dt_minPri
  40. #define dt_priority dt_maxPri
  41.   char *dt_filename;
  42.   char *dt_asname;
  43.   LONG dt_filelength;   /* In case anyone cares. Not filled in */
  44.   LONG dt_future2;
  45.   char dt_filenamebuf[1];
  46. } work_detail_node;
  47.  
  48. /* priority --- Higher the priority, the more chances we have to send it */
  49. /* range from -128 to +127 as with a node structure */
  50. /* Note: This is not the cost. Cost determines when we will CONNECT to send */
  51. /*  it, priority determines if we will send it once we are connected. */
  52.  
  53. #define DTPRI_MIN     (-128)
  54. #define DTPRI_HOLD     (-50)  /* Reccomendation only */
  55. #define DTPRI_NORM     0      /* Reccomendation only */
  56. #define DTPRI_CRASH    50     /* Reccomendation only */
  57. #define DTPRI_NETMAIL  75     /* Reccomendation only */
  58. #define DTPRI_MAX      127
  59.  
  60. /* New DT_FLAGS --- bit! */
  61. #define DTB_IFSENT      7     /* Let X= 'sent', else 'end of session' */
  62. #define DTB_DELETE      6     /* delete if X      */
  63. #define DTB_TRUNCATE    5     /* truncate if X    */
  64. #define DTB_REQUEUE     4     /* requeue if not X */
  65. #define DTF_IFSENT    (1<<DTB_IFSENT)
  66. #define DTF_DELETE    (1<<DTB_DELETE)
  67. #define DTF_TRUNCATE  (1<<DTB_TRUNCATE)
  68. #define DTF_REQUEUE   (1<<DTB_REQUEUE)
  69.  
  70.  
  71. #ifndef TRASH_OLD_PROGS
  72. /* Old flags around for compatibility. */
  73. #define OLD_DT_MAILBUNDLE   1     /* Default for mail bundles: truncate */
  74. #define OLD_DT_FILEATTACH   2     /* Default for file attaches: nothing */
  75. #define OLD_DT_DELETE       3     /* Delete after transfered. */
  76. #define OLD_DT_TRUNCATE     4     /* Truncate after transfer. */
  77. #define OLD_DT_SHOW_DELETE  5     /* "show" delete after. (?) */
  78. #define OLD_DT_NOTHING      6     /* Don't do anything afterward */
  79. #define OLD_DT_EXTRA_DELETE 7
  80. #define OLD_DT_REQUEST      8     /* Delete if sent, don't recreate */
  81. #endif
  82.  
  83. #define DT_TRUNCATE     DTF_IFSENT|DTF_TRUNCATE|DTF_REQUEUE
  84. #define DT_FILEATTACH   DTF_IFSENT|DTF_REQUEUE
  85. #define DT_DELETE       DTF_IFSENT|DTF_DELETE|DTF_REQUEUE
  86. #define DT_SHOW_DELETE  DT_DELETE
  87. #define DT_NOTHING      DT_FILEATTACH
  88. #define DT_EXTRA_DELETE DT_DELETE
  89. #define DT_REQUEST      DTF_REQUEUE|DTF_DELETE
  90. #define DT_MAILBUNDLE   DT_TRUNCATE
  91.  
  92. /* Status flags */
  93. #define DT_INTRANSIT 99
  94. #define DT_SENT       0
  95. #define DT_NOTSENT    1
  96. #define DT_HUNGUP     2
  97. #define DT_RETRIES    3
  98. #define DT_ABORT      4
  99. #define DT_REFUSED    5
  100. #define DT_PRIREJ     6
  101. #define DT_NOTFOUND  10     /* Any error greater than NOTFOUND will */
  102.                             /*  prevent the file from being queued again */
  103.  
  104. typedef struct work_detail_struct {
  105.   struct Node            wd_masterNode;
  106.   struct Node            wd_specificNode;  /* Why this exists, I really don't remember */
  107.   struct List            wd_unsentWork;    /* I'm going to leave it there just in case */
  108.   struct List            wd_sentWork;      /* I ever do remember what it was for :-)  */
  109.   struct SignalSemaphore wd_lock;
  110.   site                   wd_toWhom;
  111.   int                    wd_slowusecount;
  112.   WORD                   wd_flags;
  113.   short                  wd_maxPri;  
  114. #define wd_minPri wd_maxPri     /* renamed. Will go away soon. */
  115. #define wd_minCost wd_maxPri
  116.   short                  wd_dialcount;     /* available for the scheduler */
  117.   void                  *wd_TagList;       /* A tag list of additional things will be      */
  118.                                            /* will be put here when Tag lists are grokked. */
  119. } work_detail;
  120.  
  121. #define MASKBITS(bit)  (1<<(bit))
  122.  
  123. /* Bits for wd_flags */
  124. #define WDB_FLOW  0
  125. #define WDB_FLO   1
  126. #define WDB_HLO   2
  127. #define WDB_CLO   3
  128. #define WDB_DLO   4
  129. #define WDB_REQ   5
  130.  
  131. #define WD_OUTBOUND(d,type) ((d)->wd_flags|=MASKBITS(type))
  132. #define WD_NOOUT(d,type)    ((d)->wd_flags&=~(MASKBITS(type)))
  133. #define WD_OUTP(d,type)     ((d)->wd_flags&MASKBITS(type))
  134. #define WD_ANYOUTBOUND(d)   ((d)->wd_flags& \
  135.       (MASKBITS(WDB_FLOW) | MASKBITS(WDB_FLO) | MASKBITS(WDB_HLO) | \
  136.        MASKBITS(WDB_CLO)  | MASKBITS(WDB_DLO)))
  137.  
  138. /* Indicates that the work detail has been modified. */
  139. #define WDB_DIRTY  15
  140. #define WDF_DIRTY (1<<WDB_DIRTY)
  141.  
  142. #define ISDIRTY(d) ((d)->wd_flags&WDF_DIRTY)
  143. #define WD_DIRTY(d)   ((d)->wd_flags|=WDF_DIRTY)
  144. #define WD_CLEAN(d)   ((d)->wd_flags&=(~WDF_DIRTY))
  145.  
  146. /* Indicates that the minCost is not the minimum of the sent
  147.  * files -- it has been set by some other means.
  148.  */
  149. #define WDB_PRIORITY 14
  150. #define WDF_PRIORITY MASKBITS(WDB_PRIORITY)
  151. #define WD_PRILOCK(d)  ((d)->wd_flags&WDF_PRIORITY)
  152. #define WD_LOCKPRI(d)  ((d)->wd_flags|=WDF_PRIORITY)
  153. #define WD_UNLOCKPRI(d) ((d)->wd_flags&=(~WDF_PRIORITY))
  154.  
  155. #ifndef FLO_LIBRARY
  156. #include <exec/libraries.h>
  157. extern struct Library *FlowBase;
  158. #define FloLibrary FlowBase
  159. #endif
  160.  
  161. #define FLONAME "flow.library"
  162. #define FLOVERSION 4
  163. #define _WORK_DETAIL_
  164. #endif
  165.  
  166.