gcc 4.6.1 c89
I have a string that I need parse. The string is sdp information. I am trying to seperate each of the elements into seperate strings.
Basically the string would contain some thing like this:
v=0 o=sip_user IN 10230 22472 IP4 10.10.10.44 s=SIP_CALL c=IN IP4 10.10.10.44 m=audio 49152 RTP/AVP 0 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000
And I would like to seperate them into different strings. So this needs to be broken down into seperate strings.
str1 v=0
str2 o=sip_user IN 10230 22472 IP4 10.10.10.44
str3 s=SIP_CALL
str4 c=IN IP4 10.10.10.44
str5 m=audio 49152 RTP/AVP 0 8
str6 a=rtpmap:0 PCMU/8000
str7 a=rtpmap:8 PCMA/8000
I was trying to do something like this as a start. But even though it finds the v= I need to find when the next line will start.
char *str_v = NULL
str_v = strstr(sdp_string, "v=");
if(str_v != NULL) {
printf("found line: [ %s ]", str_v);
}
Many thanks for any suggestions,