ipmi_sol.c (9fc4a39fda91c25f4cb76375dbf50dbc3feec129) | ipmi_sol.c (eb54136775f63a6a159f3c55ee4772d7aa363cc4) |
---|---|
1/* 2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistribution of source code must retain the above copyright --- 530 unchanged lines hidden (view full) --- 539 "for SOL parameter '%s'", 540 rsp->data_len, 541 val2str(data[1], sol_parameter_vals)); 542 } 543 break; 544 case 0x80: 545 if( intf->session != NULL ) { 546 lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d", | 1/* 2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistribution of source code must retain the above copyright --- 530 unchanged lines hidden (view full) --- 539 "for SOL parameter '%s'", 540 rsp->data_len, 541 val2str(data[1], sol_parameter_vals)); 542 } 543 break; 544 case 0x80: 545 if( intf->session != NULL ) { 546 lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d", |
547 val2str(data[1], sol_parameter_vals), intf->session->port); 548 params->payload_port = intf->session->port; | 547 val2str(data[1], sol_parameter_vals), intf->ssn_params.port); 548 params->payload_port = intf->ssn_params.port; |
549 } else { 550 lprintf(LOG_ERR, 551 "Info: SOL parameter '%s' not supported - can't determine which " 552 "payload port to use on NULL session", 553 val2str(data[1], sol_parameter_vals)); 554 return (-1); 555 } 556 break; --- 673 unchanged lines hidden (view full) --- 1230 Supported escape sequences:\n\ 1231 %c. - terminate connection\n\ 1232 %c^Z - suspend ipmitool\n\ 1233 %c^X - suspend ipmitool, but don't restore tty on restart\n\ 1234 %cB - send break\n\ 1235 %c? - this message\n\ 1236 %c%c - send the escape character by typing it twice\n\ 1237 (Note that escapes are only recognized immediately after newline.)\n", | 549 } else { 550 lprintf(LOG_ERR, 551 "Info: SOL parameter '%s' not supported - can't determine which " 552 "payload port to use on NULL session", 553 val2str(data[1], sol_parameter_vals)); 554 return (-1); 555 } 556 break; --- 673 unchanged lines hidden (view full) --- 1230 Supported escape sequences:\n\ 1231 %c. - terminate connection\n\ 1232 %c^Z - suspend ipmitool\n\ 1233 %c^X - suspend ipmitool, but don't restore tty on restart\n\ 1234 %cB - send break\n\ 1235 %c? - this message\n\ 1236 %c%c - send the escape character by typing it twice\n\ 1237 (Note that escapes are only recognized immediately after newline.)\n", |
1238 intf->session->sol_escape_char, 1239 intf->session->sol_escape_char, 1240 intf->session->sol_escape_char, 1241 intf->session->sol_escape_char, 1242 intf->session->sol_escape_char, 1243 intf->session->sol_escape_char, 1244 intf->session->sol_escape_char, 1245 intf->session->sol_escape_char); | 1238 intf->ssn_params.sol_escape_char, 1239 intf->ssn_params.sol_escape_char, 1240 intf->ssn_params.sol_escape_char, 1241 intf->ssn_params.sol_escape_char, 1242 intf->ssn_params.sol_escape_char, 1243 intf->ssn_params.sol_escape_char, 1244 intf->ssn_params.sol_escape_char, 1245 intf->ssn_params.sol_escape_char); |
1246} 1247 1248 1249 1250/* 1251 * output 1252 * 1253 * Send the specified data to stdout --- 120 unchanged lines hidden (view full) --- 1374 escape_pending = 0; 1375 1376 /* 1377 * Process a possible escape sequence. 1378 */ 1379 switch (ch) { 1380 case '.': 1381 printf("%c. [terminated ipmitool]\n", | 1246} 1247 1248 1249 1250/* 1251 * output 1252 * 1253 * Send the specified data to stdout --- 120 unchanged lines hidden (view full) --- 1374 escape_pending = 0; 1375 1376 /* 1377 * Process a possible escape sequence. 1378 */ 1379 switch (ch) { 1380 case '.': 1381 printf("%c. [terminated ipmitool]\n", |
1382 intf->session->sol_escape_char); | 1382 intf->ssn_params.sol_escape_char); |
1383 retval = 1; 1384 break; 1385 1386 case 'Z' - 64: 1387 printf("%c^Z [suspend ipmitool]\n", | 1383 retval = 1; 1384 break; 1385 1386 case 'Z' - 64: 1387 printf("%c^Z [suspend ipmitool]\n", |
1388 intf->session->sol_escape_char); | 1388 intf->ssn_params.sol_escape_char); |
1389 suspendSelf(1); /* Restore tty back to raw */ 1390 continue; 1391 1392 case 'X' - 64: 1393 printf("%c^Z [suspend ipmitool]\n", | 1389 suspendSelf(1); /* Restore tty back to raw */ 1390 continue; 1391 1392 case 'X' - 64: 1393 printf("%c^Z [suspend ipmitool]\n", |
1394 intf->session->sol_escape_char); | 1394 intf->ssn_params.sol_escape_char); |
1395 suspendSelf(0); /* Don't restore to raw mode */ 1396 continue; 1397 1398 case 'B': 1399 printf("%cB [send break]\n", | 1395 suspendSelf(0); /* Don't restore to raw mode */ 1396 continue; 1397 1398 case 'B': 1399 printf("%cB [send break]\n", |
1400 intf->session->sol_escape_char); | 1400 intf->ssn_params.sol_escape_char); |
1401 sendBreak(intf); 1402 continue; 1403 1404 case '?': 1405 printSolEscapeSequences(intf); 1406 continue; 1407 1408 default: | 1401 sendBreak(intf); 1402 continue; 1403 1404 case '?': 1405 printSolEscapeSequences(intf); 1406 continue; 1407 1408 default: |
1409 if (ch != intf->session->sol_escape_char) | 1409 if (ch != intf->ssn_params.sol_escape_char) |
1410 v2_payload.payload.sol_packet.data[length++] = | 1410 v2_payload.payload.sol_packet.data[length++] = |
1411 intf->session->sol_escape_char; | 1411 intf->ssn_params.sol_escape_char; |
1412 v2_payload.payload.sol_packet.data[length++] = ch; 1413 } 1414 } 1415 1416 else 1417 { | 1412 v2_payload.payload.sol_packet.data[length++] = ch; 1413 } 1414 } 1415 1416 else 1417 { |
1418 if (last_was_cr && (ch == intf->session->sol_escape_char)) { | 1418 if (last_was_cr && (ch == intf->ssn_params.sol_escape_char)) { |
1419 escape_pending = 1; 1420 continue; 1421 } 1422 1423 v2_payload.payload.sol_packet.data[length++] = ch; 1424 } 1425 1426 --- 9 unchanged lines hidden (view full) --- 1436 * send intf->session->sol_data.max_outbound_payload_size bytes 1437 * at a time. 1438 */ 1439 if (length) 1440 { 1441 struct ipmi_rs * rsp = NULL; 1442 int try = 0; 1443 | 1419 escape_pending = 1; 1420 continue; 1421 } 1422 1423 v2_payload.payload.sol_packet.data[length++] = ch; 1424 } 1425 1426 --- 9 unchanged lines hidden (view full) --- 1436 * send intf->session->sol_data.max_outbound_payload_size bytes 1437 * at a time. 1438 */ 1439 if (length) 1440 { 1441 struct ipmi_rs * rsp = NULL; 1442 int try = 0; 1443 |
1444 while (try < intf->session->retry) { | 1444 while (try < intf->ssn_params.retry) { |
1445 1446 v2_payload.payload.sol_packet.character_count = length; 1447 1448 rsp = intf->send_sol(intf, &v2_payload); 1449 1450 if (rsp) 1451 { 1452 break; --- 369 unchanged lines hidden (view full) --- 1822 (ap_rsp.payload_udp_port[1] << 8) | 1823 ap_rsp.payload_udp_port[0]; 1824 1825 intf->session->timeout = 1; 1826 1827 1828 /* NOTE: the spec does allow for SOL traffic to be sent on 1829 * a different port. we do not yet support that feature. */ | 1445 1446 v2_payload.payload.sol_packet.character_count = length; 1447 1448 rsp = intf->send_sol(intf, &v2_payload); 1449 1450 if (rsp) 1451 { 1452 break; --- 369 unchanged lines hidden (view full) --- 1822 (ap_rsp.payload_udp_port[1] << 8) | 1823 ap_rsp.payload_udp_port[0]; 1824 1825 intf->session->timeout = 1; 1826 1827 1828 /* NOTE: the spec does allow for SOL traffic to be sent on 1829 * a different port. we do not yet support that feature. */ |
1830 if (intf->session->sol_data.port != intf->session->port) | 1830 if (intf->session->sol_data.port != intf->ssn_params.port) |
1831 { 1832 /* try byteswapping port in case BMC sent it incorrectly */ 1833 uint16_t portswap = BSWAP_16(intf->session->sol_data.port); 1834 | 1831 { 1832 /* try byteswapping port in case BMC sent it incorrectly */ 1833 uint16_t portswap = BSWAP_16(intf->session->sol_data.port); 1834 |
1835 if (portswap == intf->session->port) { | 1835 if (portswap == intf->ssn_params.port) { |
1836 intf->session->sol_data.port = portswap; 1837 } 1838 else { 1839 lprintf(LOG_ERR, "Error: BMC requests SOL session on different port"); 1840 return -1; 1841 } 1842 } 1843 1844 printf("[SOL Session operational. Use %c? for help]\n", | 1836 intf->session->sol_data.port = portswap; 1837 } 1838 else { 1839 lprintf(LOG_ERR, "Error: BMC requests SOL session on different port"); 1840 return -1; 1841 } 1842 } 1843 1844 printf("[SOL Session operational. Use %c? for help]\n", |
1845 intf->session->sol_escape_char); | 1845 intf->ssn_params.sol_escape_char); |
1846 1847 if(looptest == 1) 1848 { 1849 ipmi_sol_deactivate(intf, instance); 1850 usleep(interval*1000); 1851 return 0; 1852 } 1853 --- 233 unchanged lines hidden --- | 1846 1847 if(looptest == 1) 1848 { 1849 ipmi_sol_deactivate(intf, instance); 1850 usleep(interval*1000); 1851 return 0; 1852 } 1853 --- 233 unchanged lines hidden --- |