Lines Matching refs:incoming
137 } incoming, outgoing;
159 /* We are going to read a new message if incoming.expect is 0. */
160 if (!incoming.expect) {
161 incoming.length = 0;
162 incoming.expect = HEADER_SIZE;
168 length = incoming.expect - incoming.length;
169 if (incoming.length >= MAX_PACKET_LENGTH) {
173 if (incoming.expect > MAX_PACKET_LENGTH) {
174 length = MAX_PACKET_LENGTH - incoming.length;
176 length = recv(the_socket, &incoming.buffer[incoming.length], length, 0);
190 incoming.length += length;
192 /* If incoming.header is valid, check cookie and update incoming.expect. */
193 if (incoming.length == HEADER_SIZE && incoming.expect == HEADER_SIZE) {
194 if (incoming.header.cookie != MAGIC_COOKIE) {
199 incoming.expect = ntohs(incoming.header.length);
200 if (incoming.expect < HEADER_SIZE) {
207 /* Now we have a complete message. Reset incoming.expect. */
208 if (incoming.length == incoming.expect) {
209 incoming.expect = 0;
212 if (incoming.header.type == CONTROL_MESSAGE) {
216 (unsigned)ntohs(incoming.header.type));
430 if (incoming.length < MIN_MESSAGE_SIZE) {
434 incoming.message = ntohs(incoming.message);
435 if (incoming.message > MESSAGE_MAX || !messages[incoming.message]) {
436 log_print(DEBUG, "Received UNKNOWN %d", incoming.message);
439 if (incoming.length < lengths[incoming.message]) {
441 messages[incoming.message], incoming.length);
445 switch(incoming.message) {
448 if (incoming.sccrp.protocol_version == PROTOCOL_VERSION &&
449 ESTABLISHED(incoming.sccrp.result)) {
469 incoming.sccrq.result);
476 if (state == OCRQ && incoming.ocrp.peer == local) {
477 if (ESTABLISHED(incoming.ocrp.result)) {
478 remote = incoming.ocrp.call;
492 incoming.ocrp.result);
508 if (state == OCRP && incoming.ccrq.call == remote) {
517 if (state == OCRP && incoming.cdn.call == remote) {
528 outgoing.echorp.identifier = incoming.echorq.identifier;
535 log_print(DEBUG, "Recevied %s", messages[incoming.message]);
541 (unsigned)ntohs(incoming.icrq.call));
543 outgoing.icrp.peer = incoming.icrq.call;
551 (unsigned)ntohs(incoming.ocrq.call));
553 outgoing.ocrp.peer = incoming.ocrq.call;
560 log_print(DEBUG, "Received UNEXPECTED %s", messages[incoming.message]);