diff options
| author | Anton <anton@picapica.im> | 2026-11-25 10:50:00 +0400 |
|---|---|---|
| committer | Anton <anton@picapica.im> | 2026-11-25 10:50:00 +0400 |
| commit | 0f5ba1062894ad2cd19f79b4f8434ffbb78b9e32 (patch) | |
| tree | 9a1da1a0f49dc9d9fc9545cc451d2e49a8f126a5 | |
| parent | 4b1372eae2dba25f92de84a497983961d1d46b70 (diff) | |
| download | pica-pica-0f5ba1062894ad2cd19f79b4f8434ffbb78b9e32.tar.gz pica-pica-0f5ba1062894ad2cd19f79b4f8434ffbb78b9e32.zip | |
use English everywhere in the comments
| -rw-r--r-- | PICA_client.c | 4 | ||||
| -rw-r--r-- | PICA_msgproc.c | 8 | ||||
| -rw-r--r-- | PICA_node.c | 46 | ||||
| -rw-r--r-- | PICA_node.h | 14 | ||||
| -rw-r--r-- | PICA_nodeaddrlist.h | 8 | ||||
| -rw-r--r-- | pica-client/chatwindow.h | 2 | ||||
| -rw-r--r-- | tests/test_client.c | 10 | ||||
| -rw-r--r-- | tests/test_client_tree.c | 4 |
8 files changed, 48 insertions, 48 deletions
diff --git a/PICA_client.c b/PICA_client.c index 19110d9..c838d9f 100644 --- a/PICA_client.c +++ b/PICA_client.c @@ -1053,7 +1053,7 @@ static unsigned int procmsg_NOTFOUND(unsigned char* buf, unsigned int nb, void* } if (!rq) - return 0;// ERR_CHECK -левое сообщение, такой запрос не посылался + return 0;// ERR_CHECK - bogus message, no such request was sent //puts("procmsg_NOTFOUND_chkp0");//debug PICA_close_c2c(rq); @@ -1089,7 +1089,7 @@ static unsigned int procmsg_FOUND(unsigned char* buf, unsigned int nb, void* p) } if (!rq) - return 0;// ERR_CHECK -левое сообщение, такой запрос не посылался + return 0;// ERR_CHECK - bogus message, no such request was sent ret = c2c_start(rq); diff --git a/PICA_msgproc.c b/PICA_msgproc.c index 27629d9..b95bd1c 100644 --- a/PICA_msgproc.c +++ b/PICA_msgproc.c @@ -20,8 +20,8 @@ #include "PICA_msgproc.h" -//возвращает размер сообщения либо UINT_MAX,если количество прочитанных байт недостаточно для определения размера -//либо 0 при ошибочных данных +//returns the message size, or UINT_MAX if not enough bytes have been read to determine the size, +//or 0 if the data is invalid unsigned int PICA_msggetsize(unsigned char *buf, unsigned int nb, struct PICA_msginfo *msgs, unsigned int nmsg) { unsigned int i; @@ -61,7 +61,7 @@ unsigned int PICA_msggetsize(unsigned char *buf, unsigned int nb, struct PICA_ms return 0; } -//Определяет тип сообщения размера size, находящегося в буфере buf, вызывает соответствующий обработчик и передает обработчику аргумент arg. Возвращает значение, которое вернула функция-обработчик сообщения. Если тип сообщения неизвестен, возвращает 0 +//Determines the type of the message of size size located in buffer buf, calls the corresponding handler and passes it the argument arg. Returns the value returned by the message handler. Returns 0 if the message type is unknown unsigned int PICA_processmsg(unsigned char *buf, unsigned int size, void* arg, struct PICA_msginfo *msgs, unsigned int nmsg) { int i; @@ -95,7 +95,7 @@ unsigned int PICA_processdatastream(unsigned char *buf, unsigned int *read_pos, *read_pos -= uret; - memmove(buf, buf + uret, *read_pos); //сдвиг содержимого буфера к началу + memmove(buf, buf + uret, *read_pos); //move the buffer contents to the beginning } return 1; diff --git a/PICA_node.c b/PICA_node.c index 419cb29..ecf4d9e 100644 --- a/PICA_node.c +++ b/PICA_node.c @@ -412,8 +412,8 @@ unsigned int procmsg_CONNID(unsigned char* buf, unsigned int size, void* ptr) { struct client *c; -//проверка IP адреса. -//IP адрес должен совпадать с адресом клиента в управляющем соединении +//IP address check. +//IP address must match the client's address in the control connection if (link->state == PICA_CCLINK_LOCAL_WAITCONNCLE || link->state == PICA_CCLINK_N2NCLE_WAITCONNCLE) c = link->p2; @@ -449,7 +449,7 @@ unsigned int procmsg_NODECONNREQ(unsigned char* buf, unsigned int size, void* pt if (buf[2] == PICA_PROTO_VER_HIGH && buf[3] == PICA_PROTO_VER_LOW) { - ////-прием входящего подключения + ////-accepting incoming connection //-------------------------- nc->state = PICA_NEWCONN_SENDINGOK; /*struct nodelink *nl; @@ -520,7 +520,7 @@ int nodelink_send_searchreq(const unsigned char *id) unsigned int procmsg_CONNREQOUTG(unsigned char* buf, unsigned int size, void* ptr) { - struct client *i, *o; //i - указатель на вызывающего клиента, o - вызываемого(если найден) + struct client *i, *o; //i - pointer to the calling client, o - to the callee (if found) unsigned char *callee_id; struct PICA_proto_msg *mp; @@ -545,7 +545,7 @@ unsigned int procmsg_CONNREQOUTG(unsigned char* buf, unsigned int size, void* pt return 1; } - //отправить o _CONNREQINC + //send _CONNREQINC to o if ((mp = client_wbuf_push(o, PICA_PROTO_CONNREQINC, PICA_PROTO_CONNREQINC_SIZE))) { memcpy(mp->tail, i->id, PICA_ID_SIZE); @@ -556,7 +556,7 @@ unsigned int procmsg_CONNREQOUTG(unsigned char* buf, unsigned int size, void* pt return 1; } - return 1;//сообщение отправить не удалось, но все равно возвращаем 1 + return 1;//failed to send the message, but return 1 anyway } if (cclink_list_findwaitsearch(callee_id)/*search request for this id is already in progress*/ @@ -566,7 +566,7 @@ unsigned int procmsg_CONNREQOUTG(unsigned char* buf, unsigned int size, void* pt return 1; } -//отправить i _NOTFOUND +//send _NOTFOUND to i if ((mp = client_wbuf_push(i, PICA_PROTO_NOTFOUND, PICA_PROTO_NOTFOUND_SIZE))) { memcpy(mp->tail, callee_id, PICA_ID_SIZE); @@ -634,7 +634,7 @@ unsigned int procmsg_CONNDENY(unsigned char* buf, unsigned int size, void* ptr) if (link->state == PICA_CCLINK_LOCAL_WAITREP) { - //отправить caller _NOTFOUND + //send _NOTFOUND to caller if ((mp = client_wbuf_push(caller, PICA_PROTO_NOTFOUND, PICA_PROTO_NOTFOUND_SIZE))) { memcpy(mp->tail, callee->id, PICA_ID_SIZE); @@ -642,7 +642,7 @@ unsigned int procmsg_CONNDENY(unsigned char* buf, unsigned int size, void* ptr) } else if (link->state == PICA_CCLINK_N2NCLE_WAITREP) { - //отправить caller N2NNOTFOUND + //send N2NNOTFOUND to caller if ((mp = nodelink_wbuf_push(link->caller_node, PICA_PROTO_N2NNOTFOUND, PICA_PROTO_N2NNOTFOUND_SIZE))) { memcpy(mp->tail, caller_id, PICA_ID_SIZE); @@ -1113,7 +1113,7 @@ unsigned int procmsg_NODELISTREQ(unsigned char* buf, unsigned int size, void* pt { //TEMP FIXME CONF -//собственный адрес узла +//node's own address nl_buf[nl_size] = PICA_PROTO_NEWNODE_IPV4; *((in_addr_t*)(nl_buf + nl_size + 1)) = inet_addr(my_addr); *((in_port_t*)(nl_buf + nl_size + 5)) = (nodecfg.listen_port ? htons(atoi(nodecfg.listen_port)) : htons(PICA_COMM_PORT)); //CONF @@ -1510,7 +1510,7 @@ void cclink_list_delete(struct cclink *l) } } -//удаление из глобального списка +//removal from the global list if (l->prev) l->prev->next = l->next; else @@ -1640,7 +1640,7 @@ struct cclink* cclink_list_add(struct client *clr, struct client *cle) l->p1 = clr; l->p2 = cle; -//добавление в глобальный список +//adding to the global list if (cclink_list_head) { cclink_list_end->next = l; @@ -2095,9 +2095,9 @@ void newconns_init() } } -//функция ищет свободный элемент в массиве структур newconn и возвращает на него указатель -//В случае, если свободный элемент не найден, возвращается элемент с наиболее поздней отметкой времени, -//при этом соединение закрывается +//finds a free element in the newconn structure array and returns a pointer to it +//If no free element is found, the element with the latest timestamp is returned, +//and its connection is closed struct newconn* newconn_add(struct newconn *ncs, int *pos) { time_t min; @@ -2255,7 +2255,7 @@ void client_attach_multi_secondary(struct client *primary, struct client *second void client_tree_remove(struct client* ci) { - struct client** p_link;//указывает на left или right в родительском узле + struct client** p_link;//points to left or right in the parent node if (!ci->up) { @@ -2294,7 +2294,7 @@ void client_tree_remove(struct client* ci) { struct client *lm; lm = ci->right; - while(lm->left) lm = lm->left; //поиск самого левого узла правого поддерева + while(lm->left) lm = lm->left; //find the leftmost node of the right subtree if (lm != ci->right) { @@ -2405,7 +2405,7 @@ void client_list_delete(struct client* ci) PICA_debug1("client_list_delete(%p)", (void*)ci); SSL_free(ci->ssl_comm); -//удаление из списка +//removal from the list if (ci->prev) ci->prev->next = ci->next; else @@ -2416,7 +2416,7 @@ void client_list_delete(struct client* ci) else client_list_end = ci->prev; -//удаление из дерева +//removal from the tree s = client_tree_search(ci->id); if (s == ci) @@ -3448,7 +3448,7 @@ void process_c2n_write(evutil_socket_t s, short event, void *arg) } } if (ret == 1) - //проверить сертификат пользователя + //check the user's certificate { X509* client_cert; struct client *primary; @@ -3458,7 +3458,7 @@ void process_c2n_write(evutil_socket_t s, short event, void *arg) client_cert = SSL_get_peer_certificate (i_ptr->ssl_comm); if (!client_cert) { - //ERR_CHECK //нет сертификата + //ERR_CHECK //no certificate kill_ptr = i_ptr; } @@ -3499,7 +3499,7 @@ void process_c2n_write(evutil_socket_t s, short event, void *arg) } if (!ret) { - //ERR_CHECK //не уникальный id + //ERR_CHECK //id is not unique kill_ptr = i_ptr; } } @@ -4172,7 +4172,7 @@ int pica_node_main(int argc, char** argv) ); } - PICA_node_joinskynet(nodecfg.nodes_db_file, nodecfg.announced_addr);//CONF-CONF имя файла с адресами узлов, свой адрес + PICA_node_joinskynet(nodecfg.nodes_db_file, nodecfg.announced_addr);//CONF-CONF node addresses file name, own address my_addr = nodecfg.announced_addr;//TEMP FIXME diff --git a/PICA_node.h b/PICA_node.h index 82ddb32..921485f 100644 --- a/PICA_node.h +++ b/PICA_node.h @@ -132,11 +132,11 @@ struct client unsigned int r_pos; unsigned int w_pos; - unsigned int btw_ssl;//кол-во отправляемых байтов, передаваемое функции SSL_write -//Если требуется повторный вызов SSL_write,то нужно передавать те же значения аргументов,а w_pos может быть увеличен + unsigned int btw_ssl;//number of bytes to send, passed to SSL_write +//If SSL_write has to be retried, the same argument values must be passed, while w_pos may be increased // int state; - struct client* next;//структура client может быть одновременно в составе дерева и линейного списка + struct client* next;//a client structure can be in a tree and a linked list at the same time struct client* prev; time_t tmst; @@ -155,7 +155,7 @@ struct client time_t udpaddr_req_tmst; }; -struct cclink //структура, описывающая соединение двух клиентов между собой через сервер +struct cclink //describes a connection between two clients through the server { //unsigned int cclink_id; unsigned int state; @@ -198,7 +198,7 @@ enum newconn_type NEWCONN_N2N }; -struct newconn //структура, описывающая новое подключение (клиента) +struct newconn //describes a new (client) connection { SOCKET sck; SSL *anonssl; @@ -222,8 +222,8 @@ struct nodelink SOCKET sck; SSL *anonssl; - unsigned int addr_type;//тип адреса узла - PICA_PROTO_NEWNODE_IPV4,PICA_PROTE_NEWNODE_IPV6,... - void *node_addr;//указатель на структуру адреса {PICA_nodeaddr_ipv4, PICA_nodeaddr_ipv6,PICA_nodeaddr_dns,..} + unsigned int addr_type;//node address type - PICA_PROTO_NEWNODE_IPV4,PICA_PROTE_NEWNODE_IPV6,... + void *node_addr;//pointer to the address structure {PICA_nodeaddr_ipv4, PICA_nodeaddr_ipv6,PICA_nodeaddr_dns,..} unsigned char *r_buf; unsigned char *w_buf; diff --git a/PICA_nodeaddrlist.h b/PICA_nodeaddrlist.h index a674ca2..4933eca 100644 --- a/PICA_nodeaddrlist.h +++ b/PICA_nodeaddrlist.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -// Описание структур и функций для работы со списком адресов узлов +// Structures and functions for working with the node address list // #ifndef PICA_NODEADDRLIST_H #define PICA_NODEADDRLIST_H @@ -57,10 +57,10 @@ struct PICA_nodeaddr_dns struct PICA_nodeaddr { - char addr[256];//макс. длина DNS имени 255 символов - int inactive_count;//кол-во зафиксированных подряд случаев недоступности узла + char addr[256];//max. DNS name length is 255 characters + int inactive_count;//number of consecutive times the node was found unreachable time_t last_active;// - in_port_t port;//номер порта - host byte order + in_port_t port;//port number - host byte order struct PICA_nodeaddr *next; }; diff --git a/pica-client/chatwindow.h b/pica-client/chatwindow.h index 50d6231..a60393c 100644 --- a/pica-client/chatwindow.h +++ b/pica-client/chatwindow.h @@ -58,7 +58,7 @@ signals: public slots: void msg_from_peer(QString msg); void msg_delivered(); - void msg_informational(QString text);//юзер в оффлайне, набирает сообщение, и т.д. серым шрифтом, курсив + void msg_informational(QString text);//user is offline, is typing, etc. - gray italic font void set_peer_name(); void update_status(QString status); diff --git a/tests/test_client.c b/tests/test_client.c index 320e0bb..88a2913 100644 --- a/tests/test_client.c +++ b/tests/test_client.c @@ -54,7 +54,7 @@ int accept_cb(const unsigned char *id) return 1; } -//получение сообщения. +//message received. void newmsg_cb(const unsigned char *peer_id, const char* msgbuf, unsigned int nb, int type) { @@ -87,13 +87,13 @@ void newmsg_cb(const unsigned char *peer_id, const char* msgbuf, unsigned int nb printf(" %s: ", PICA_id_to_base64(peer_id, NULL)); puts(buf); } -//получение подтверждения о доставке сообщения +//message delivery confirmation received void msgok_cb(const unsigned char *peer_id) { delivery_acks_count++; puts("[V]"); } -//создание канала с собеседником +//channel with the peer created void c2c_established_cb(const unsigned char *peer_id, const char *ciphersuitename) { c2c_active = 1; @@ -109,9 +109,9 @@ void c2c_failed_cb(const unsigned char *peer_id) chn = 0; } -//входящий запрос на создание канала от пользователя с номером caller_id +//incoming channel request from the user with id caller_id //<<int accept_cb(unsigned int caller_id); -//запрошенный пользователь не найден, в оффлайне или отказался от общения +//requested user not found, offline, or refused to talk void notfound_cb(const unsigned char *callee_id) { puts("notfound_cb"); diff --git a/tests/test_client_tree.c b/tests/test_client_tree.c index 81076f8..e343234 100644 --- a/tests/test_client_tree.c +++ b/tests/test_client_tree.c @@ -120,7 +120,7 @@ void client_tree_print(struct client *c) void client_tree_remove(struct client* ci) { - struct client** p_link;//указывает на left или right в родительском узле + struct client** p_link;//points to left or right in the parent node if (!ci->up) { @@ -159,7 +159,7 @@ void client_tree_remove(struct client* ci) { struct client *lm; lm = ci->right; - while(lm->left) lm = lm->left; //поиск самого левого узла правого поддерева + while(lm->left) lm = lm->left; //find the leftmost node of the right subtree if (lm != ci->right) { |
