00001 #ifndef _PORTS_H
00002 #define _PORTS_H
00003
00004 #include "../constants.h"
00005 #include "Policies.h"
00006 #include "hashDefault.h"
00007
00008
00009
00010 #ifndef _PORT_HANDLERS_
00011 #define _PORT_HANDLERS_
00012
00013 typedef int OutputPortHandler;
00014 typedef int InputPortHandler;
00015 #endif
00016
00017 #define OP_STATE_OPEN 1
00018 #define OP_STATE_CLOSED 0
00019
00020
00021
00022 typedef void (GetLabel)(void *msg, int tamMsg, char label[]);
00023 typedef int (Hash)(char *label, int image);
00024 typedef void (MLSHash)(char *label, int image, int destArray[]);
00025
00026 typedef struct __LabeledStreamData {
00027 void *lsHandler;
00028 char libname[MAX_LNAME_LENGTH+1];
00029 Hash *hash;
00030 MLSHash *mlshash;
00031 GetLabel *getLabel;
00032 } LabeledStreamData;
00033
00034
00035
00036 typedef struct {
00037 char *name;
00038 int numDestinations;
00039 int *tidsDestinations;
00040 writePolicy_t writePolicy;
00041 int tag;
00042 int nextToSend;
00043 LabeledStreamData lsData;
00044 int state;
00045 }OutputPort;
00046
00047
00048 OutputPort *createOutputPort();
00049
00050
00051 void destroyOutputPort(OutputPort *o);
00052
00053
00054 void closeOutputPort(OutputPort *o);
00055
00056
00057 void resetOutputPort(OutputPort *o);
00058
00059
00060
00061 void setOPState(OutputPort *op, int state);
00062 void setOPName(OutputPort *op, const char *name);
00063 void setOPNumDestinations(OutputPort *op, int num);
00064 void setOPWritePolicy(OutputPort *op, writePolicy_t p);
00065 void setOPNextToSend(OutputPort *op, int next);
00066 void setOPLibName(OutputPort *op, const char *libname);
00067 void setOPTidsDestinations(OutputPort *op, const int *tids);
00068 void setOPTag(OutputPort *op, int tag);
00069
00070
00071 int loadOPLSData(OutputPort *op);
00072 int loadOPMLSData(OutputPort *op);
00073
00074
00075
00076
00077
00078 typedef struct {
00079 char *name;
00080 int numSources;
00081 int *tidsSources;
00082 int tag;
00083 int numEowRecv;
00084 } InputPort;
00085
00086
00087 InputPort *createInputPort();
00088
00089 void destroyInputPort(InputPort *o);
00090
00091
00092 void resetInputPort(InputPort *ip);
00093
00094
00095 void setIPName(InputPort *ip, const char *name);
00096 void setIPNumSources(InputPort *ip, int num);
00097 void setIPTag(InputPort *ip, int tag);
00098 void setIPTidsSources(InputPort *ip, const int *tids);
00099 void setNumEowRecv(InputPort *ip, int numRecv);
00100
00101
00102 #endif