send_to_kernel(&msg);
}
+/**
+ * Sends message to kernel
+ * @param msg Message to send.
+ */
void NETMOD::send_to_kernel(MESSAGE *msg)
{
write(kernel_sock, msg, sizeof(MESSAGE));
}
+/**
+ * Sends message to given node
+ * @param lnk Interpreter link.
+ * @param msg Message to send.
+ */
void NETMOD::send_to_node(NETlink *lnk, MESSAGE *msg)
{
msg->msg_type = MSG_NET;
}
}
+/**
+ * Sends message to interpreter
+ * @param msg Message to send.
+ */
void NETMOD::send_to_int(MESSAGE *msg)
{
INTlink *pomlink;
}
}
-
-
void NETMOD::accept_connection()
{
unsigned int sz;
}
-/************** Internal message from kernel or INT ********************/
-
+/**
+ * Internal message from kernel or INT
+ */
void NETMOD::get_internal()
{
int nr;
};
break;
break;
- } /* MSg_VLP */
+ }
}
}
- }/* ISSET */
- } /* select >0 */
+ }
+ }
}
void NETMOD::get_message(NETlink *lnk)
send_to_int(&msg);
}
break;
- } /* end switch */
- }
- } /* nr > 0 */
+ }
+ }
+ }
- } /* end if used */
+ }
}
pomlink = findNETlink(msg->param.pword[4]);
if ((pomlink != NULL) && (pomlink->connected))
- send_to_node(pomlink,msg);
+ send_to_node(pomlink, msg);
else {
if (msg->param.pword[1] == MSG_INT) {
send_to_int(msg);
Links.clear();
}
-NETlink *NETMOD::findNETlink(int node)
+NETlink * NETMOD::findNETlink(int node)
{
NETlink *pomlink;
pomlink = Links.first();
return pomlink;
}
-INTlink *NETMOD::findINTlink(int id)
+INTlink * NETMOD::findINTlink(int id)
{
INTlink *pomlink;
pomlink = Interpreters.first();
}
-/* ---------------- Sending code to a remote node -------------- */
-
+/**
+ * Sending code to a remote node
+ */
void NETMOD::transmit_file(int ton, char *fname, int fromINT)
{
FILE *f;
fd_set rset;
fd_set wset;
- /***************** CCD FILE*/
+ /***************** CCD FILE */
strcpy(fn, fname);
strcat(fn, ".ccd");
f = fopen(fn, "rb");
if (FD_ISSET(sock, &rset))
tsock = accept(sock, (struct sockaddr*)&svr,
&sz);
- if (tsock>0) {
+ if (tsock > 0) {
close(sock);
while (!feof(f)) {
i = fread(&proto, 1, sizeof(proto), f);
write(sk, &m, sizeof(MESSAGE));
}
-int main(int argc,char **argv)
+int main(int argc, char **argv)
{
NETMOD netter(argv[1]);
netter.run();