Safety Property: NetConnectionMaxReceiveAmount

property NetConnectionMaxReceiveAmount (maxBytes: int) {
  // Limit total data sent through each connection.
  requires IndividualNetworkByteCount;
  check RNetConnection.preReceive (nbytes: int) {
    if (bytesReceived + nbytes > maxBytes) {
      violation 
        ("Maximum per-connection receive data amount exceeded for connection " +
         toString () + ". Maximum of " + maxBytes + 
         " bytes per connection. Already received " + 
         bytesReceived + ". About to receive " +
         nbytes + " bytes.");
    }
  }
}

About this file

Naccio Home Page
David Evans
University of Virginia, Computer Science