/* * test for occurrence of RFC1918 IP address in Contact HF */ static int contact_1918(struct sip_msg* msg) { struct sip_uri uri; contact_t* c; if (get_contact_uri(msg, &uri, &c) == -1) return -1; return (is1918addr(&(uri.host)) == 1) ? 1 : 0; }
/* * test for occurrence of RFC1918 IP address in SDP */ static int sdp_1918(struct sip_msg* msg) { str body, ip; int pf; if (extract_body(msg, &body) == -1) { LOG(L_ERR,"ERROR: sdp_1918: cannot extract body from msg!\n"); return 0; } if (extract_mediaip(&body, &ip, &pf) == -1) { LOG(L_ERR, "ERROR: sdp_1918: can't extract media IP from the SDP\n"); return 0; } if (pf != AF_INET || isnulladdr(&ip, pf)) return 0; return (is1918addr(&ip) == 1) ? 1 : 0; }
/** * Checks if the first Via in the message is a 1918 address * @param msg - the SIP message * @returns 1 if it is, 0 if not */ static int via_1918(struct sip_msg * msg) { return (is1918addr(&(msg->via1->host)) == 1) ? 1 : 0; }