struct sdp_info *parse_sdp(char *sdp, int len)
{
- char *pos;
+ char *pos, *line;
static struct sdp_info sdpinfo;
/* RFC 2327
bzero(&sdpinfo, sizeof(struct sdp_info));
- pos = sdp;
+ pos = line = sdp;
while(*pos != 0 && (pos-sdp) < len) {
if (*pos == 0x0d)
*pos = 0;
if (*pos == 0x0a) {
*pos = 0;
- if (!strncasecmp("s=", sdp, 2)) {
- sdpinfo.service = sdp + 2;
- } else if (!strncasecmp("c=", sdp, 2)) {
+ if (!strncasecmp("s=", line, 2)) {
+ sdpinfo.service = line + 2;
+ } else if (!strncasecmp("c=", line, 2)) {
int poscnt = 0;
- sdp += 2;
- while (*sdp != 0) {
- if (poscnt == 2 && *sdp == '/') {
- *sdp = 0;
+ line += 2;
+ while (*line != 0) {
+ if (poscnt == 2 && *line == '/') {
+ *line = 0;
break;
}
- if (*sdp == ' ') {
- *sdp = 0;
+ if (*line == ' ') {
+ *line = 0;
poscnt++;
/* c=<network type> <address type> <connection address> */
if (poscnt == 2)
- sdpinfo.host = sdp + 1;
+ sdpinfo.host = line + 1;
if (poscnt > 2)
break;
}
- sdp++;
+ line++;
}
- } else if (!strncasecmp("m=", sdp, 2)) {
+ } else if (!strncasecmp("m=", line, 2)) {
int poscnt = 0;
- sdp += 2;
- while (*sdp != 0) {
- if (*sdp == ' ') {
- *sdp = 0;
+ line += 2;
+ while (*line != 0) {
+ if (*line == ' ') {
+ *line = 0;
poscnt++;
/* m=<media> <port> <transport> <fmt list> */
if (poscnt == 1)
- sdpinfo.port = sdp + 1;
+ sdpinfo.port = line + 1;
if (poscnt == 2)
- sdpinfo.proto = sdp + 1;
+ sdpinfo.proto = line + 1;
if (poscnt > 2)
break;
}
- sdp++;
+ line++;
}
}
- sdp = ++pos;
+ line = ++pos;
continue;
}
pos++;