/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Return the scope of the given address. staticint ipv6_scope(constunsignedchar addr[16]) { constunsignedchar* b = addr; unsignedshort w = (unsignedshort)((b[0] << 8) | b[1]);
if ((b[0] & 0xFE) == 0xFC) { return IPV6_SCOPE_UNIQUELOCAL;
} switch (w & 0xFFC0) { case 0xFE80: return IPV6_SCOPE_LINKLOCAL; case 0xFEC0: return IPV6_SCOPE_SITELOCAL; case 0x0000:
w = b[1] | b[2] | b[3] | b[4] | b[5] | b[6] | b[7] | b[8] | b[9] | b[10] |
b[11] | b[12] | b[13] | b[14]; if (w || b[15] != 0x01) { break;
} return IPV6_SCOPE_NODELOCAL; default: break;
}
return IPV6_SCOPE_GLOBAL;
}
} // namespace utils
} // namespace net
} // namespace mozilla
#endif// NETWORK_IPV6_UTILS_H_
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.