MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / has_body_f

Function has_body_f

modules/sipmsgops/sipmsgops.c:899–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

897
898
899static int has_body_f(struct sip_msg *msg, void *type)
900{
901 struct body_part * p;
902
903 if ( msg->content_length==NULL ) {
904 if (parse_headers(msg,HDR_CONTENTLENGTH_F, 0)==-1)
905 return -1;
906
907 if (msg->rcv.proto!=PROTO_UDP && (
908 (msg->content_length==NULL) || get_content_length (msg)==0 ) ) {
909 LM_DBG("no content length hdr or zero len\n");
910 /* Nothing to see here, please move on. */
911 return -1;
912 }
913 }
914
915 if( ( ((int)(long)type )>>16) == TYPE_MULTIPART )
916 {
917 int mime = parse_content_type_hdr(msg);
918
919 if( mime == ((int)(long)type ) )
920 return 1;
921
922 return -1;
923 }
924
925 /* check type also? */
926 if (type==0)
927 return 1;
928
929 if (parse_sip_body(msg)<0 || msg->body==NULL) {
930 LM_DBG("no body found\n");
931 return -1;
932 }
933
934 p = &msg->body->first;
935 while (p)
936 {
937 if( p->mime == ((int)(long)type ) )
938 return 1;
939 p = p->next;
940 }
941
942 return -1;
943}
944
945
946static int is_privacy_f(struct sip_msg *msg, void *privacy)

Callers

nothing calls this directly

Calls 2

parse_content_type_hdrFunction · 0.85
parse_sip_bodyFunction · 0.85

Tested by

no test coverage detected