int globMyId : id of the coordinator.
int globLastIndex : An integer variable that indicates
the total number of cordinators present in the ARC ring.
lockRequest : The list that contains the list of
locks.
FiLE *fptr: This is the pointer to the file in which
RIB is stored.
This interface is responsible for posting the
information about the RIB's (Remote Instruction Blocks) to the remote machines
onto which RIB's will be sent for execution.
Whenever a coordinator P wants to send a RIB for execution on a
remote coordinator Q,
then different steps are performed at coordinator Q :
u_long* post_rib_inf_5_svc(RibInf* ribInf, struct svc_req
*junk2)
Argument: The information about the RIB. The information contained in the RibInf are following :
On the client side:
The function is called
by the user library on the local coordinator when the user RIB's have to
be posted for execution.
On the server side :
The ribInf information
contains the information about the coordinator on which the RIB will be
sent to execute. This is stored in the nodeId field of the RibInf
structure. Let P be the coordinator on which this function call has been
made. The following steps are carried out in this function :
1) From the nodeId field,
if it the case that the RIB is to be executed locally then invoke the function
ExecuteFile(ribInf).
The need for checking the difference in machine architecture does not arise
here because the RIB is executing locally, and hence no compilation required.
Return from the function.
2) If the RIB is to
be executed remotely, say on coordinator Q, then create a client handle
with Q.
3) Compare the machine
architecture of coordinator P with that of Q.
*
If different, then to the ribInf also add the .x file name and the
_proc
file name of the RIB. The .x file will be used by the coordinator Q's to
run rpcgen and generate client and stub files. _proc file contains
the C implementation of the RIB. All these are required by coordinator
Q for the purpose of compilation.
*
However if the two machine architectures are same, we need to send the
executable file format. The name of the executable file is added to ribInf.
4) For each of the file
name present in the modified ribInf, the function PostFile(String
fileName, CLIENT* cl) is called once along with the client handle,
so that the file could be send to coordinator Q.
5) After having sent
the file, call the RPC function process_rib_svc() on the remote coordinator
to carry out the processing of the RIBs.
int* init_file_ptr_3_svc(String* fileName, struct svc_req
*Jlt1)
This is a RPC function and it is used to initialize
the posting of the RIB. The
function receives as an argument the name of the file fileName,
that is to be
initialized. The function opens the file fileName in the write
mode. The client for this function is the coordinator that wants to send
the RIB.
The result of the operation
is returned to the calling client.
int* put_in_file_3_svc(String* data, struct svc_req
*Jlt1)
This is a RPC function and it receives as argument,
the data that is to be
written in the file. The file should have been initialized earlier
through the function int* init_file_ptr_3_svc(String* fileName,
struct svc_req *Jlt1). The data is written in the file.
int* close_file_3_svc(String* str, struct svc_req *Jlt1)
This is a RPC function and it calls close on
the file handle fptr.
u_long* process_rib_3_svc(RibInf* ribInf, struct svc_req*
junk)
This is a RPC call and it is invoked by one
coordinator(that has posted the RIB)
on the other coordinator (that has received the RIB). This function
is responsible to
compile the RIB, if required, and execute it.
The information about the machine architecture
is taken from the ribInf. If the
architecture differs from the one on which the RIB is to execute,
then compilation of
code needs to be done. For this, the function calls CompileFile(ribInf).
The function
finally calls ExecuteFile(ribInf) for executing the RIB.
void* cleanup_3_svc(RibInf* ribInf, struct svc_req* junk)
This is a RPC function called by the user library
to perform the clean-up of the
RIB's after the execution. The function receives as argument the
information about the RIB,ribInf that is to be cleaned-up. From the ribInf,
it is checked if the nodeId where the RIB was executing is same as the
nodeId of the coordinator receiving this RPC call. If yes, then local execution
of the RIB's have taken place.
If not, the coordinator call RPC function remove_files_svc(ribInf)
on the coordinator on which the RIB was executing.
void* remove_files_3_svc(RibInf* ribInf, struct svc_req* junk)
The function is a RPC service and it is called
to delete all traces of RIB code. The function receives as argument the
information about the RIB that was posted earlied. From this information,
the function obtains the name of the RIB code and then it deletes all the
files related to that RIB.
int PostFile( String fileName, CLIENT* cl)
This function is a helper function and it is
called by the coordinator, locally to send a file to a remote coordinator.
It receives as argument the name of the file that is to be sent and the
coordinator (client handle) to which the file is to be sent. Let Q be the
node at which the RIB will be remotely executed.
This function first calls the RPC function init_file_ptr_svc(String
fileName) to initialize the process of sending the file. Now the contents
of the file, that is to be sent, is read in a buffer fileData and
the RPC function put_in_file_svc(String fileData) is called to send
the file to Q. All the RPC function calls are made on the client handle
cl.
After the file has been transfered, the RPC function close_file_svc(String
fileName) is called to close the file pointer at coordinator Q.
void CompileFile( RibInf* ribInf)
This is not a RPC function. As an argument,
it receives the information about
the RIB's that have been send to this coordinator for compilation.
The RIB info contains the name of the RIB code that is to be compiled.
The function executes the executable "exeser" and gives the RIB code name
as command line argument to this executable. The job of exeser is to first
run rpcgen on the file(it comes to know about the file through the command
line argument) and then compile the server and client stubs. The file having
the extension as_proc con tains the implementation for the remote function.
This file is used to generate an executable file.
void ExecuteFile( RibInf *ribInf)
This is also not a RPC function. Its purpose
is to execute the RIB code. Firstly it obtains the name of the RIB code
through the RIB info provided and then changes the mode of the file to
executable mode. The executable file, which is a RPC server is then run.
This is called a ARC function executer process.