handleCommand method

void handleCommand(
  1. List<int> bytes
)

Implementation

void handleCommand(List<int> bytes) {
  if (bytes.length < 2 || bytes[0] != iac) return;
  int command = bytes[1];

  if (command >= 251 && command <= 254) {
    if (bytes.length < 3) return;
    int option = bytes[2];
    switch (command) {
      case will:
        handleWill(option);
        break;
      case wont:
        handleWont(option);
        break;
      case doCmd:
        handleDo(option);
        break;
      case dont:
        handleDont(option);
        break;
    }
  } else if (command == ayt) {
    handleAyt();
  }
}