X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Fnet%2Flognet.cpp;h=7a93bc0661b919dd188ef21523117900918aaadd;hb=c93d8517f5609af29641b70460f61fb1363f468e;hp=f6211bbb88f05de40fc3aa1e72038257bd8875a9;hpb=abed78d4382b70979c3a6eb492ca1a6a9ee16fa1;p=vlp.git diff --git a/src/net/lognet.cpp b/src/net/lognet.cpp index f6211bb..7a93bc0 100644 --- a/src/net/lognet.cpp +++ b/src/net/lognet.cpp @@ -289,11 +289,20 @@ void NETMOD::write_at_console(char *s) 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; @@ -303,6 +312,10 @@ void NETMOD::send_to_node(NETlink *lnk, MESSAGE *msg) } } +/** + * Sends message to interpreter + * @param msg Message to send. + */ void NETMOD::send_to_int(MESSAGE *msg) { INTlink *pomlink; @@ -313,8 +326,6 @@ void NETMOD::send_to_int(MESSAGE *msg) } } - - void NETMOD::accept_connection() { unsigned int sz; @@ -380,8 +391,9 @@ void NETMOD::check_node(int n, int sc) } -/************** Internal message from kernel or INT ********************/ - +/** + * Internal message from kernel or INT + */ void NETMOD::get_internal() { int nr; @@ -501,11 +513,11 @@ void NETMOD::get_internal() }; break; break; - } /* MSg_VLP */ + } } } - }/* ISSET */ - } /* select >0 */ + } + } } void NETMOD::get_message(NETlink *lnk) @@ -612,11 +624,11 @@ void NETMOD::get_message(NETlink *lnk) send_to_int(&msg); } break; - } /* end switch */ - } - } /* nr > 0 */ + } + } + } - } /* end if used */ + } } @@ -824,7 +836,7 @@ void NETMOD::propagate_msg(MESSAGE *msg) 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); @@ -1022,7 +1034,7 @@ void NETMOD::disconnect_seq() Links.clear(); } -NETlink *NETMOD::findNETlink(int node) +NETlink * NETMOD::findNETlink(int node) { NETlink *pomlink; pomlink = Links.first(); @@ -1035,7 +1047,7 @@ NETlink *NETMOD::findNETlink(int node) return pomlink; } -INTlink *NETMOD::findINTlink(int id) +INTlink * NETMOD::findINTlink(int id) { INTlink *pomlink; pomlink = Interpreters.first(); @@ -1048,8 +1060,9 @@ INTlink *NETMOD::findINTlink(int id) } -/* ---------------- Sending code to a remote node -------------- */ - +/** + * Sending code to a remote node + */ void NETMOD::transmit_file(int ton, char *fname, int fromINT) { FILE *f; @@ -1065,7 +1078,7 @@ void NETMOD::transmit_file(int ton, char *fname, int fromINT) fd_set rset; fd_set wset; - /***************** CCD FILE*/ + /***************** CCD FILE */ strcpy(fn, fname); strcat(fn, ".ccd"); f = fopen(fn, "rb"); @@ -1157,7 +1170,7 @@ void NETMOD::transmit_file(int ton, char *fname, int fromINT) 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); @@ -1213,7 +1226,7 @@ void NETMOD::conn_info(int sk) write(sk, &m, sizeof(MESSAGE)); } -int main(int argc,char **argv) +int main(int argc, char **argv) { NETMOD netter(argv[1]); netter.run();