sanityCheck function

bool sanityCheck(
  1. IncomingMessage m,
  2. PitelUA u,
  3. Transport t
)

Implementation

bool sanityCheck(IncomingMessage m, PitelUA u, Transport t) {
  message = m;
  ua = u;
  transport = t;

  for (bool Function() check in all) {
    if (check() == false) {
      return false;
    }
  }

  if (message is IncomingRequest) {
    for (bool Function() check in requests) {
      if (check() == false) {
        return false;
      }
    }
  } else if (message is IncomingResponse) {
    for (bool Function() check in responses) {
      if (check() == false) {
        return false;
      }
    }
  }

  // Everything is OK.
  return true;
}