These are the calls that applications use to interact with TMTP.
int CreateGroup(char *pgName, char *by, int typeofCommn)
pgName
pgName
is the name of the process group.
by
by
is the name of the person creating the group.
typeofCommn
typeofcommn
is DISSEMINATION
or
GROUP
(??)
CreateGroup
creates a TMTP group and registers it with the session
directory. A negative return value indicates failure.
int JoinGroup(char *pgName, int joinMode)
pgName
pgName
is the name of the process group.
joinMode
joinMode
is how the calling process wants to
join the group. It can be either SENDER
,
RECEIVER
or BOTH
.
JoinGroup
joins the calling process into the group with the
specified mode and registers the process with the session
directory. A negative return value indicates failure.
int LeaveGroup(char *pgName, int leaveMode)
pgName
pgName
is the name of the process group.
leaveMode
leaveMode
is how the calling process wants to
leave the group. It can be either SENDER
,
RECEIVER
or BOTH
.
LeaveGroup
removes the calling process from the group with the
specified mode and registers this info with the session directory.
A negative return value indicates failure.
int DeleteGroup(char *pgName, char *by)
pgName
pgName
is the name of the process group.
by
by
is the person who is deleting the group. It
should be the same as the person who created the group.
DeleteGroup
deletes the group and registers this info
with the session directory. A negative return value indicates failure.
int tmtp_send(int gid, char *msg, int len, sockaddr
*replyaddr)
gid
gid
is a group id number returned by joingroup.
msg
msg
is a pointer to a buffer containing
data to be sent to the group.
len
len
is the number of bytes to send.
replyaddr
replyaddr
is the unicast address that this
process will listen on for unicast replies to the
process. this field is optional.
A message id for use in subsequent
tmtp_waitformsg()
call is returned.
int tmtp_recv(int gid, char *msg, int len,
sockaddr *replyaddr, senderinfo *senderaddr)
gid
gid
is a group id number returned by joingroup.
msg
msg
is a pointer to a buffer into which data
should be read.
len
len
is the maximum length of msg
buffer.
replyaddr
replyaddr
is the unicast address that the sending
process listens on for unicast replies to the process. this
field is optional.
senderaddr
senderaddr
will contain the sender's machine
address and process id (maybe just the processes port id).
The number of bytes contained in the message (or an error value) is returned.
int TMTPWaitForMsg(int mId)
mId
mId
is the unique message id returned by
TMTPSend
.
TMTPWaitForMsg
returns when all the intended
receivers of the message have received all the packets of the
message.