PVM_COVER

[Description and Idea]     [Warnings]     [Methods]     [Atributes]     [Operators]     [Specials]

List of predecestors:

Files:

Description[Back]

This class covers PVM (Parallel Virtual Machine). This means that it contains all functions needed for spawning tasks, communication, retrieving messages, getting information etc. These functions "cover" the using of PVM, so non of the successors would have to call any PVM routine directly.

Warnings[Back]

In the current version, PVM_COVER expects the PVM daemon to be running. So first start pvm console ("pvm" ENTER) then spawn the parent task (e.g. "pvm -> projekt/pvm/testparent" ENTER; the part "->" specifies that standard output is redirected to the console).

Important changes since the last version :

Important changes since the last version :

Important structures used in PVM_COVER :

typedef struct MSG_COMMONtag
{
  int msgTag;
  int priority;
  int senderType;
  int specMsgTag;
  int msgLen;
  int senderPid;
  int contentType;
  int amount;
} MSG_COMMON;
typedef MSG_COMMON * LPMSG_COMMON;
typedef struct PVMHOSTINFOtag
{
  int id;
  char *name, *arch;
  int speed;
} PVMHOSTINFO;
typedef PVMHOSTINFO *LPPVMHOSTINFO;
typedef struct PVMTASKINFOtag
{
  int procID, parentID, hostID, flag;
  char *fileName;
} PVMTASKINFO;
typedef PVMTASKINFO * LPPVMTASKINFO;

Methods[Back]

Outside PVM_COVER:
int startDaemon (char **hostNames, int hostAmount);
void sprintError (int pvmError, char *string, int maxLen);
int haltDaemon ();
int exitPvm ();

Public:
Constructors and Destructors
PVM_COVER ();
~PVM_COVER ();

General
void deleteHostInfo (int hostAmount,PVMHOSTINFO *hostInfos);
void deleteTaskInfo (int taskAmount, PVMTASKINFO *taskInfos);

Coating
int getMsgAmount ();
int getMsgBufLen ();
BOOL isMsg ();

Coating PVM
int getMyPid ();
int getParentPid ();
int killProc (int procPid);
int startProcess (char *fileName, char **argv, int taskAmount);
int startProcess (char *fileName, char **argv, char *hostName, int taskAmount, int *procPids);
int getHostInfo (int *hostAmount, int *archAmount, PVMHOSTINFO **hostInfos);
BOOL isHostAlive (char *hostName);
int getTaskInfo (int *taskAmount, PVMTASKINFO **taskInfos);
BOOL isTaskAlive (int procPid);

Receiving
void unpackMsg (int bufID, void **msg, int *msgTag, int *msgLen, int *senderProc, int *dataLen);
void wasteMsgs ();
int pvmRetrieve ();
int waitForMsg (int senderPid, int msgTag, int timeOut);
BOOL getSpecificMsg (int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);
BOOL peekSpecificMsg (int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);
int getNextMsgLen ();
BOOL getNextMsg (char **msg);

============= Sending =============
BOOL sendTypes (int destProc, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);
BOOL multicastTypes (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);
BOOL sendBytes (int destProc, int senderType, int priority, int msgTag, int specMsgTag, BYTE *lpBytes, int byteAmount);
BOOL multicastBytes (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE *lpBytes, int byteAmount);
BOOL sendTypeMap (int destProc, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);
BOOL multicastTypeMap (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);

Protected:
BOOL getMsgFromBuffer (BYTE **buffer, int *msgAmount, int *bufLen, BYTE **msg);
BOOL addMsgToBuffer (BYTE **buffer, int *msgAmount, int *bufLen, BYTE *msg);
BOOL peekMsgFromBuffer (BYTE *buffer, int msgAmount, int bufLen, BYTE **msg);
void* findSpecMsgInBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag);
int countSpecMsgInBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag);
BOOL peekSpecMsgFromBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);
BOOL getSpecMsgFromBuffer (BYTE **buffer, int *msgAmount, int *bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);

Private:
BOOL sending (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);
BOOL sendingMaps (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);



int startDaemon (char **hostNames, int hostAmount);

Tries to start PVM daemon. The daemon can eventually be running. If the daemon is successfully started (or runs already), than new hosts are added to the PVM configuration. If an error occurs during adding any of the hosts, there is a message dumped into the output file.

Arguments:

hostNames ......... hostNames (every name in form : "ulab-12"). Can be NULL.
hostAmount ........ amount of host names in the array. Can be 0.

Returns:

PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void sprintError (int pvmError, char *string, int maxLen);

This function copies an error description to the place identified by "string", that identifies the type of error which occured during a call to a PVM routine (== "pvmError") or to above mentioned PVM_COVER calls.

Arguments:

pvmError........................value returned from a call to a PVM routine
string..........................place to put the error description to
maxLen..........................size of the string memory

Returns:

void

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int haltDaemon ();

Halts the local PVM daemon and also all PVM daemons on other hosts in the configuration.

Arguments:

none

Returns:

PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int exitPvm ();

This functions removes this task from PVM. After this call the local process cannot send nor receive no messages as it is removed from the queue of active tasks managed by PVM daemon. (If You are using PVM_CODEC, do not call this function before deleting the object, because PVM_CODEC in destructor still needs to communicate)

Arguments:

none

Returns:

PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


PVM_COVER ();

Only initialization of internal atributes.

Arguments:

none

Returns:

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


~PVM_COVER ();

Freeing allocated space.

Arguments:

none

Returns:

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void deleteHostInfo (int hostAmount, PVMHOSTINFO *hostInfos);

Deletes an array of PVMHOSTINFO (tppvm.h) structs. This function is really not neccessary but might be useful.

Arguments:

hostAmount ......... amount of hosts (amount of structs in the array)
hostInfos .......... pointer to an array of
PVMHOSTINFO structs

Returns:

void

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void deleteTaskInfo (int taskAmount, PVMTASKINFO *taskInfos);

Similar as deleteHostInfo but deletes an array of PVMTASKINFO structs

Arguments:

taskAmount ......... amount of tasks (amount of structs in the array)
taskInfos .......... pointer to an array of
PVMTASKINFO structs

Returns:

void

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getMsgAmount ();

Simply returns the amount of messages currently retrieved from PVM. (It does not respect number of messages in any buffered message - PVM_COVER does not consider buffering)

Arguments:

none

Returns:

Amount of messages in PVM_COVER buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getMsgBufLen ();

Returns the overall length of all currently retrieved messages.

Arguments:

none

Returns:

Overall length of messages in PVM_COVER buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL isMsg ();

Tests if there is a currently retrieved message. This function usually follows after a call to pvmRetrieve ();

Arguments:

none

Returns:

TRUE if there is a message in PVM_COVER buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getMyPid ();

Every process has its unique ID (Pid == Process ID) created by PVM. This number is used as an address for sending data. This function returns the ID of its local process (== task).

Arguments:

none

Returns:

Process ID of the local task.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getParentPid ();

Returns the process ID of parent of the local task (If this function is called for our "PVM_PARENT" it returns the process ID of PVM daemon).

Arguments:

none

Returns:

Process ID of parent of the local task.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int killProc (int procPid);

This functions sends a "terminate" signal (SIGTERM) to a process identified by procPid. (It is not expected to be called for killing the calling process - in this case use exitPvm() followed by conventional exit procedure);

Arguments:

procPid ......... process ID of the process to be killed

Returns:

PVM error code (0 if OK, less then zero indicates an error)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int startProcess (char *fileName, char **argv, int taskAmount);

Implemented as a call to the other startProcess call.

Arguments:

fileName ................ file name of the executable file
argv .................... standard C argument strings (can be NULL)
taskAmount .............. amount of processes to be started

Returns:

The amount of started processes, 0 if some error occurs or PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int startProcess (char *fileName, char **argv, char *hostName, int taskAmount, int *procPids);

This function spawns "taskAmount" of processes of the "fileName" file name passing the conventional "argv" array of arguments. The "hostName" can be NULL, or it can be a name of a machine in the current PVM configuration where these processes should be started. Additionally this function returns pids of tasks spawned during this call. (e.g. number = startProcess ("projekt/pvm/testchild", NULL, "ulab-10", 3, pids); )

Arguments:

fileName ................ file name of the executable file
argv .................... standard C argument strings (can be NULL)
hostName ................ name of the host to start the processes on
taskAmount .............. amount of processes to be started
procPids ................ process IDs of the processes started during this call

Returns:

The amount of started processes, 0 if some error occurs or PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getHostInfo (int *hostAmount, int *archAmount, PVMHOSTINFO **hostInfos);

This function retrieves from PVM some configuration info. Most of it is stored in an array of structs (is allocated in here - for deallocation use "deleteHostInfo").

Arguments:

hostAmount ........... number of hosts in the PVM configuration
archAmount ........... number of different architectures
hostInfos ............ array of
PVMHOSTINFO structs
("hostAmount" items) is allocated inside the routine.

Returns:

PVM return value

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL isHostAlive (char *hostName);

Tests if the specified host is currently present in the PVM configuration.

Arguments:

hostName ............... string identifying the required host (e.g. "ulab-13")

Returns:

TRUE if the host is present

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getTaskInfo (int *taskAmount, PVMTASKINFO **taskInfos);

Similar to the function above but retrieves information about tasks currently running under PVM. It only returns information about process that were spawned by the same user (e.g. if I am jtup4479, I do not get info about tasks spawned by msub4459 even if they are running on the same machine).

Arguments:

taskAmount ........... number of processes currently running under PVM.
taskInfos ............ array of
PVMTASKINFO structs.

Returns:

PVM return value (see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL isTaskAlive (int procPid);

Tests if the specified task is currently running under PVM.

Arguments:

procPid ............ the process ID of the required task

Returns:

TRUE if such running task found

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void unpackMsg (int bufID, void **msg, int *msgTag, int *msgLen, int *senderProc, int *dataLen);

This function unpacks data from PVM buffer into the PVM_COVER messages buffer. It respects the data type information included in every message to guarantee architecture independency. For more information look for message sending description in the "Docs" section.

Arguments:

bufID ................. PVM buffer ID
msg ................... pointer to
MSG_COMMON struct (this struct is included in every message)
msgLen ................ length of the message
msgData ............... message data
dataLen ............... length of message data (usually == msgLen - sizeof(MSG_COMMON))
msgTag ................ message tag (info supplied by PVM; always == msg->msgTag)
senderProc ............ process ID of the sender (--- || -- ; always == msg->senderPid)

Returns:

void

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void wasteMsgs ();

This call destroys all currently retrieved messages in PVM_COVER message buffer.

Arguments:

none

Returns:

void

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int pvmRetrieve ();

This function has to be called to retrieve all received msgs from PVM buffer into PVM_COVER message buffer. This function would be usually followed by call to "isMsg ()".

Arguments:

none

Returns:

0 if everything is OK or PVM return value (see above) in case of an error.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int waitForMsg (int senderPid, int msgTag, int timeOut);

If the message has not yet arrived (or if it is not present in PVM_COVER message buffer), the call to this function would put the calling process to sleep until the specified message would arrive.

Arguments:

senderPid ........... process ID of the sender (-1 would match any sender)
msgTag .............. message tag of the expected message (-1 would match any tag)
timeOut ............. amount of seconds to wait (-1 means if no message arrives, sleep forever)

Returns:

0 if the message did not arrive in the specified amount of time.
1 if OK
< if an error occurs (PVM return value - see above)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL getSpecificMsg (int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);

This function retrieves a message of specified attributes from the PVM_COVER message buffer (this function would typically follow a call to pvmRetrieve). For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. getSpecificMsg (-1, SENDER_PARENT, -1, -1, MT_PID, 0, msg);)

Arguments:

senderPid ........... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............. highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag
msg ..................... a place to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or there is no message in the specified buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL peekSpecificMsg (int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);

This function reads a message of specified attributes from the PVM_COVER message buffer (this function would typically follow a call to pvmRetrieve). The message is not erased from the buffer. For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. getSpecificMsg (-1, SENDER_PARENT, -1, -1, MT_PID, 0, msg);)

Arguments:

senderPid ........... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............. highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag
msg ..................... a place to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or there is no message in the specified buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int getNextMsgLen ();

Gets the length of the next message present in the PVM_COVER message buffer (the buffer works as a queue).

Arguments:

none

Returns:

The next message length (including MSG_COMMON header)

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL getNextMsg (char **msg);

Retrieves the first message from the PVM_COVER message buffer and removes it from the buffer.

Arguments:

msg ............ pointer to address of message memory (space is allocated here)

Returns:

TRUE if there is any message in the PVM_COVER buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL sendTypes (int destProc, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);

This function sends a sequence of simple data types. The data type constants are included in consts.h in module basic. For more information look for message sending description in the "Docs" section.

Arguments:

destProc ........ process ID of the destination process
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
type ............ destinguishes the data type
types ........... array of constants of the specified data type
typeAmount ...... number of constants in the array

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL multicastTypes (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);

The same as above, but the function multicasts the message to different processes.

Arguments:

destProc ........ array of process IDs of the destination processes
destProcAmount .. number of destination processes
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
type ............ destinguishes the data type
types ........... array of constants of the specified data type
typeAmount ...... number of constants in the array

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL sendBytes (int destProc, int senderType, int priority, int msgTag, int specMsgTag, BYTE *lpBytes, int byteAmount);

Implemented as a call to the function sendTypes but with a specific type (TYPE_BYTE).

Arguments:

destProc ........ process ID of the destination process
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
lpBytes ......... array of bytes
byteAmount ...... number of bytes

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL multicastBytes (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE *lpBytes, int byteAmount);

The same as above, but the function multicasts the message to different processes.

Arguments:

destProc ........ array of process IDs of the destination processes
destProcAmount .. number of destination processes
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
lpBytes ......... array of bytes
byteAmount ...... number of bytes

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL sendTypeMap (int destProc, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);

This function is similar to "sendTypes" but it sends a type map. This function would be used everytime any serialized data would be sent.

Arguments:

destProc ........ process ID of the destination process
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
lpMap ........... address of the type map
mapLen .......... length of the type map

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL multicastTypeMap (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);

The same as above, but the function multicasts the message to different processes.

Arguments:

destProc ........ array of process IDs of the destination processes
destProcAmount .. number of destination processes
senderType .......type of the sending process (see above)
priority .........priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
lpMap ........... address of the type map
mapLen .......... length of the type map

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL getMsgFromBuffer (BYTE **buffer, int *msgAmount, int *bufLen, BYTE **msg);

This function retrieves the first message from the specified buffer, reallocates it and modifies "msgAmount" and "bufLen" atributes.

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... pointer to message amount atribute
bufLen .................. pointer to buffer length atribute
msg ..................... a place to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or there is no message in the specified buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL addMsgToBuffer (BYTE **buffer, int *msgAmount, int *bufLen, BYTE *msg);

This function adds the specified message to the specified buffer and modifies "msgAmount" and "bufLen" atributes.

Arguments:

buffer .................. the buffer to add message to
msgAmount ............... pointer to message amount atribute
bufLen .................. pointer to buffer length atribute
msg ..................... the message

Returns:

TRUE if the message was successfully added. FALSE if there is insufficient memory

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL peekMsgFromBuffer (BYTE *buffer, int msgAmount, int bufLen, BYTE **msg);

This function copies the first message from "buffer" to the "msg", but does not remove it from the buffer and modifies neither the "msgAmount" nor the "bufLen".

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... amount of messages in buffer
bufLen .................. length of the buffer
msg ..................... a place to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or there is no message in the specified buffer

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


void* findSpecMsgInBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag);

This function looks for a message of specified attributes in the specified buffer. For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. point = findSpecMsgInBuffer (allMsgBuf, msgAmount, bufLen, -1, SENDER_PARENT, -1, -1, MT_PID, 0);)

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... amount of messages in buffer
bufLen .................. length of the buffer
senderPid .. ......... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............ highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag

Returns:

NULL if no message of this type found or the function returns pointer to the found message.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int countSpecMsgInBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag);

This function looks for all messages of specified attributes in the specified buffer. For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. point = findSpecMsgInBuffer (allMsgBuf, msgAmount, bufLen, -1, SENDER_PARENT, -1, -1, MT_PID, 0);)

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... amount of messages in buffer
bufLen .................. length of the buffer
senderPid .. ......... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............ highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag

Returns:

amount of messages of the specified type

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL peekSpecMsgFromBuffer (BYTE *buffer, int msgAmount, int bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);

This function retrieves a message of specified attributes from the specified buffer, but does not remove it from the buffer and modifies neither the "msgAmount" nor the "bufLen". For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. peekSpecMsgFromBuffer (allMsgBuf, msgAmount, bufLen, -1, SENDER_PARENT, -1, -1, MT_PID, 0, &msg);)

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... amount of messages in buffer
bufLen .................. length of the buffer
senderPid .. ......... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............ highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag
msg ..................... a space to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or no specified message was found.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL getSpecMsgFromBuffer (BYTE **buffer, int *msgAmount, int *bufLen, int senderPid, int senderType, int priorityLow, int priorityHigh, int msgTag, int msgSpecTag, BYTE **msg);

This function retrieves a message of specified attributes from the specified buffer and reallocates the buffer and modifies the "msgAmount" and "bufLen". For description of the attributes look at the MSG_COMMON structure. You can specify "-1" instead of any of the message attributes. (e.g. getSpecMsgFromBuffer (&allMsgBuf, &msgAmount, &bufLen, -1, SENDER_PARENT, -1, -1, MT_PID, 0, &msg);)

Arguments:

buffer .................. the buffer to retrieve message from
msgAmount ............... amount of messages in buffer
bufLen .................. length of the buffer
senderPid .. ......... process ID of the sender
senderType .............. type of the sending process (see above)
priorityLow ............. lowest priority of the message
priorityHigh ............ highest priority of the message
msgTag .................. message tag
msgSpecTag .............. specific message tag
msg ..................... a space to put the message to (is allocated here)

Returns:

TRUE if the message was successfully retrieved. FALSE if either there is insufficient memory or no specified message was found.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL sending (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, BYTE type, void *types, int typeAmount);

This function really carries out the functionality of "sendTypes" and "multicastTypes". It either multicasts or sends simple constants depending on the destProcAmount.

Arguments:

destProc ........ array of process IDs of the destination processes
destProcAmount .. number of destination processes
senderType ...... type of the sending process (see above)
priority ........ priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
type ............ destinguishes the data type
types ........... array of constants of the specified data type
typeAmount ...... number of constants in the array

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL sendingMaps (int *destProc, int destProcAmount, int senderType, int priority, int msgTag, int specMsgTag, void *lpMap, int mapLen);

This function really carries out the functionality of "sendTypeMap" and "multicastTypeMap". It either multicasts or simply sends the type map depending on the destProcAmount.

Arguments:

destProc ........ array of process IDs of the destination processes
destProcAmount .. number of destination processes
senderType ...... type of the sending process (see above)
priority ........ priority of the message
msgTag .......... message tag
specMsgTag ...... special message tag (designed for use by a future user)
lpMap ........... address of the type map
mapLen .......... length of the type map

Returns:

TRUE if message was sent. FALSE if either there is insufficient memory or an error occurs during the call to a PVM routine.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)




Atributes

Public:
BOOL terminate;
BOOL pause;
Protected:
Private:
BYTE * allMsgBuf;
int allMsgBufLen;
int allMsgAmount;


BOOL terminate;

This atribute is never set by this layer. In a future version the TRUE value of this attribute would cause the whole process to terminate itself.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BOOL pause;

This atribute is never set by this layer. In a future version the TRUE value of this attribute would put the whole process to sleep.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


BYTE * allMsgBuf;

This array of unsigned chars is used to hold messages currently retrieved from PVM buffer by "pvmRetrieve" or "waitForMessage".

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int allMsgBufLen;

The overall length of messages currently present in allMsgBuf

arrow3u.gif (362 bytes) Up.gif (1072 bytes)


int allMsgAmount;

The number of messages currently present in allMsgBuf.

arrow3u.gif (362 bytes) Up.gif (1072 bytes)