Lines Matching refs:tn

203   struct TELNET *tn;  in init_telnet()  local
205 tn = calloc(1, sizeof(struct TELNET)); in init_telnet()
206 if(!tn) in init_telnet()
209 Curl_dyn_init(&tn->out, 0xffff); in init_telnet()
210 data->req.p.telnet = tn; /* make us known */ in init_telnet()
212 tn->telrcv_state = CURL_TS_DATA; in init_telnet()
215 CURL_SB_CLEAR(tn); in init_telnet()
218 tn->us_preferred[CURL_TELOPT_SGA] = CURL_YES; in init_telnet()
219 tn->him_preferred[CURL_TELOPT_SGA] = CURL_YES; in init_telnet()
226 tn->us_preferred[CURL_TELOPT_BINARY] = CURL_YES; in init_telnet()
227 tn->him_preferred[CURL_TELOPT_BINARY] = CURL_YES; in init_telnet()
235 tn->him_preferred[CURL_TELOPT_ECHO] = CURL_YES; in init_telnet()
248 tn->subnegotiation[CURL_TELOPT_NAWS] = CURL_YES; in init_telnet()
255 struct TELNET *tn = data->req.p.telnet; in negotiate() local
261 if(tn->us_preferred[i] == CURL_YES) in negotiate()
264 if(tn->him_preferred[i] == CURL_YES) in negotiate()
328 struct TELNET *tn = data->req.p.telnet; in set_remote_option() local
330 switch(tn->him[option]) { in set_remote_option()
332 tn->him[option] = CURL_WANTYES; in set_remote_option()
341 switch(tn->himq[option]) { in set_remote_option()
344 tn->himq[option] = CURL_OPPOSITE; in set_remote_option()
353 switch(tn->himq[option]) { in set_remote_option()
358 tn->himq[option] = CURL_EMPTY; in set_remote_option()
365 switch(tn->him[option]) { in set_remote_option()
371 tn->him[option] = CURL_WANTNO; in set_remote_option()
376 switch(tn->himq[option]) { in set_remote_option()
381 tn->himq[option] = CURL_EMPTY; in set_remote_option()
387 switch(tn->himq[option]) { in set_remote_option()
389 tn->himq[option] = CURL_OPPOSITE; in set_remote_option()
402 struct TELNET *tn = data->req.p.telnet; in rec_will() local
403 switch(tn->him[option]) { in rec_will()
405 if(tn->him_preferred[option] == CURL_YES) { in rec_will()
406 tn->him[option] = CURL_YES; in rec_will()
419 switch(tn->himq[option]) { in rec_will()
422 tn->him[option] = CURL_NO; in rec_will()
426 tn->him[option] = CURL_YES; in rec_will()
427 tn->himq[option] = CURL_EMPTY; in rec_will()
433 switch(tn->himq[option]) { in rec_will()
435 tn->him[option] = CURL_YES; in rec_will()
438 tn->him[option] = CURL_WANTNO; in rec_will()
439 tn->himq[option] = CURL_EMPTY; in rec_will()
450 struct TELNET *tn = data->req.p.telnet; in rec_wont() local
451 switch(tn->him[option]) { in rec_wont()
457 tn->him[option] = CURL_NO; in rec_wont()
462 switch(tn->himq[option]) { in rec_wont()
464 tn->him[option] = CURL_NO; in rec_wont()
468 tn->him[option] = CURL_WANTYES; in rec_wont()
469 tn->himq[option] = CURL_EMPTY; in rec_wont()
476 switch(tn->himq[option]) { in rec_wont()
478 tn->him[option] = CURL_NO; in rec_wont()
481 tn->him[option] = CURL_NO; in rec_wont()
482 tn->himq[option] = CURL_EMPTY; in rec_wont()
492 struct TELNET *tn = data->req.p.telnet; in set_local_option() local
494 switch(tn->us[option]) { in set_local_option()
496 tn->us[option] = CURL_WANTYES; in set_local_option()
505 switch(tn->usq[option]) { in set_local_option()
508 tn->usq[option] = CURL_OPPOSITE; in set_local_option()
517 switch(tn->usq[option]) { in set_local_option()
522 tn->usq[option] = CURL_EMPTY; in set_local_option()
529 switch(tn->us[option]) { in set_local_option()
535 tn->us[option] = CURL_WANTNO; in set_local_option()
540 switch(tn->usq[option]) { in set_local_option()
545 tn->usq[option] = CURL_EMPTY; in set_local_option()
551 switch(tn->usq[option]) { in set_local_option()
553 tn->usq[option] = CURL_OPPOSITE; in set_local_option()
566 struct TELNET *tn = data->req.p.telnet; in rec_do() local
567 switch(tn->us[option]) { in rec_do()
569 if(tn->us_preferred[option] == CURL_YES) { in rec_do()
570 tn->us[option] = CURL_YES; in rec_do()
572 if(tn->subnegotiation[option] == CURL_YES) in rec_do()
576 else if(tn->subnegotiation[option] == CURL_YES) { in rec_do()
578 tn->us[option] = CURL_YES; in rec_do()
591 switch(tn->usq[option]) { in rec_do()
594 tn->us[option] = CURL_NO; in rec_do()
598 tn->us[option] = CURL_YES; in rec_do()
599 tn->usq[option] = CURL_EMPTY; in rec_do()
605 switch(tn->usq[option]) { in rec_do()
607 tn->us[option] = CURL_YES; in rec_do()
608 if(tn->subnegotiation[option] == CURL_YES) { in rec_do()
614 tn->us[option] = CURL_WANTNO; in rec_do()
615 tn->himq[option] = CURL_EMPTY; in rec_do()
626 struct TELNET *tn = data->req.p.telnet; in rec_dont() local
627 switch(tn->us[option]) { in rec_dont()
633 tn->us[option] = CURL_NO; in rec_dont()
638 switch(tn->usq[option]) { in rec_dont()
640 tn->us[option] = CURL_NO; in rec_dont()
644 tn->us[option] = CURL_WANTYES; in rec_dont()
645 tn->usq[option] = CURL_EMPTY; in rec_dont()
652 switch(tn->usq[option]) { in rec_dont()
654 tn->us[option] = CURL_NO; in rec_dont()
657 tn->us[option] = CURL_NO; in rec_dont()
658 tn->usq[option] = CURL_EMPTY; in rec_dont()
798 struct TELNET *tn = data->req.p.telnet; in check_telnet_options() local
810 beg = curl_slist_append(tn->telnet_vars, buffer); in check_telnet_options()
812 curl_slist_free_all(tn->telnet_vars); in check_telnet_options()
813 tn->telnet_vars = NULL; in check_telnet_options()
816 tn->telnet_vars = beg; in check_telnet_options()
817 tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES; in check_telnet_options()
835 if(l < sizeof(tn->subopt_ttype)) { in check_telnet_options()
836 strcpy(tn->subopt_ttype, arg); in check_telnet_options()
837 tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES; in check_telnet_options()
848 if(l < sizeof(tn->subopt_xdisploc)) { in check_telnet_options()
849 strcpy(tn->subopt_xdisploc, arg); in check_telnet_options()
850 tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES; in check_telnet_options()
860 beg = curl_slist_append(tn->telnet_vars, arg); in check_telnet_options()
865 tn->telnet_vars = beg; in check_telnet_options()
866 tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES; in check_telnet_options()
882 tn->subopt_wsx = (unsigned short)x; in check_telnet_options()
883 tn->subopt_wsy = (unsigned short)y; in check_telnet_options()
884 tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES; in check_telnet_options()
901 tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO; in check_telnet_options()
902 tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO; in check_telnet_options()
921 curl_slist_free_all(tn->telnet_vars); in check_telnet_options()
922 tn->telnet_vars = NULL; in check_telnet_options()
942 struct TELNET *tn = data->req.p.telnet; in suboption() local
945 printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2); in suboption()
946 switch(CURL_SB_GET(tn)) { in suboption()
948 len = strlen(tn->subopt_ttype) + 4 + 2; in suboption()
951 CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE); in suboption()
960 len = strlen(tn->subopt_xdisploc) + 4 + 2; in suboption()
963 CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE); in suboption()
977 for(v = tn->telnet_vars; v; v = v->next) { in suboption()
1020 struct TELNET *tn = data->req.p.telnet; in sendsuboption() local
1026 CURL_SB_CLEAR(tn); in sendsuboption()
1027 CURL_SB_ACCUM(tn, CURL_IAC); in sendsuboption()
1028 CURL_SB_ACCUM(tn, CURL_SB); in sendsuboption()
1029 CURL_SB_ACCUM(tn, CURL_TELOPT_NAWS); in sendsuboption()
1032 x = htons(tn->subopt_wsx); in sendsuboption()
1033 y = htons(tn->subopt_wsy); in sendsuboption()
1036 CURL_SB_ACCUM(tn, uc1[0]); in sendsuboption()
1037 CURL_SB_ACCUM(tn, uc1[1]); in sendsuboption()
1038 CURL_SB_ACCUM(tn, uc2[0]); in sendsuboption()
1039 CURL_SB_ACCUM(tn, uc2[1]); in sendsuboption()
1041 CURL_SB_ACCUM(tn, CURL_IAC); in sendsuboption()
1042 CURL_SB_ACCUM(tn, CURL_SE); in sendsuboption()
1043 CURL_SB_TERM(tn); in sendsuboption()
1046 printsub(data, '>', (unsigned char *)tn->subbuffer + 2, in sendsuboption()
1047 CURL_SB_LEN(tn)-2); in sendsuboption()
1050 bytes_written = swrite(conn->sock[FIRSTSOCKET], tn->subbuffer, 3); in sendsuboption()
1057 send_telnet_data(data, (char *)tn->subbuffer + 3, 4); in sendsuboption()
1059 bytes_written = swrite(conn->sock[FIRSTSOCKET], tn->subbuffer + 7, 2); in sendsuboption()
1078 struct TELNET *tn = data->req.p.telnet; in telrcv() local
1100 switch(tn->telrcv_state) { in telrcv()
1102 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1112 tn->telrcv_state = CURL_TS_IAC; in telrcv()
1117 tn->telrcv_state = CURL_TS_CR; in telrcv()
1126 tn->telrcv_state = CURL_TS_WILL; in telrcv()
1129 tn->telrcv_state = CURL_TS_WONT; in telrcv()
1132 tn->telrcv_state = CURL_TS_DO; in telrcv()
1135 tn->telrcv_state = CURL_TS_DONT; in telrcv()
1138 CURL_SB_CLEAR(tn); in telrcv()
1139 tn->telrcv_state = CURL_TS_SB; in telrcv()
1142 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1149 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1157 tn->please_negotiate = 1; in telrcv()
1159 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1164 tn->please_negotiate = 1; in telrcv()
1166 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1171 tn->please_negotiate = 1; in telrcv()
1173 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1178 tn->please_negotiate = 1; in telrcv()
1180 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1185 tn->telrcv_state = CURL_TS_SE; in telrcv()
1187 CURL_SB_ACCUM(tn, c); in telrcv()
1202 CURL_SB_ACCUM(tn, CURL_IAC); in telrcv()
1203 CURL_SB_ACCUM(tn, c); in telrcv()
1204 tn->subpointer -= 2; in telrcv()
1205 CURL_SB_TERM(tn); in telrcv()
1209 tn->telrcv_state = CURL_TS_IAC; in telrcv()
1212 CURL_SB_ACCUM(tn, c); in telrcv()
1213 tn->telrcv_state = CURL_TS_SB; in telrcv()
1216 CURL_SB_ACCUM(tn, CURL_IAC); in telrcv()
1217 CURL_SB_ACCUM(tn, CURL_SE); in telrcv()
1218 tn->subpointer -= 2; in telrcv()
1219 CURL_SB_TERM(tn); in telrcv()
1221 tn->telrcv_state = CURL_TS_DATA; in telrcv()
1241 struct TELNET *tn = data->req.p.telnet; in send_telnet_data() local
1243 DEBUGASSERT(tn); in send_telnet_data()
1250 Curl_dyn_reset(&tn->out); in send_telnet_data()
1253 result = Curl_dyn_addn(&tn->out, &buffer[i], 1); in send_telnet_data()
1256 result = Curl_dyn_addn(&tn->out, "\xff", 1); in send_telnet_data()
1259 outlen = Curl_dyn_len(&tn->out); in send_telnet_data()
1260 outbuf = Curl_dyn_uptr(&tn->out); in send_telnet_data()
1291 struct TELNET *tn = data->req.p.telnet; in telnet_done() local
1295 if(!tn) in telnet_done()
1298 curl_slist_free_all(tn->telnet_vars); in telnet_done()
1299 tn->telnet_vars = NULL; in telnet_done()
1300 Curl_dyn_free(&tn->out); in telnet_done()
1329 struct TELNET *tn; in telnet_do() local
1337 tn = data->req.p.telnet; in telnet_do()
1497 if(tn->please_negotiate && !tn->already_negotiated) { in telnet_do()
1499 tn->already_negotiated = 1; in telnet_do()
1593 if(tn->please_negotiate && !tn->already_negotiated) { in telnet_do()
1595 tn->already_negotiated = 1; in telnet_do()