+struct sdp_info {
+       char *service;
+       char *host;
+       char *proto;
+       char *port;
+};
+
+struct sdp_info *parse_sdp(char *sdp, int len)
+{
+       char *pos, *line;
+       static struct sdp_info sdpinfo;
+
+       /* RFC 2327
+        * v=0
+        * o=- 6dca 1 IN IP4 192.168.100.17:2000
+        * s=TV Das Erste
+        * t=0 0
+        * c=IN IP4 192.168.100.17/1
+        * m=video 2000 http 33
+        * a=tool:getstream
+        * a=type:broadcast
+        */
+
+       bzero(&sdpinfo, sizeof(struct sdp_info));
+
+       pos = line = sdp;
+       while(*pos != 0 && (pos-sdp) < len) {
+               if (*pos == 0x0d)
+                       *pos = 0;
+
+               if (*pos == 0x0a) {
+                       *pos = 0;
+
+                       if (!strncasecmp("s=", line, 2)) {
+                               sdpinfo.service = line + 2;
+                       } else if (!strncasecmp("c=", line, 2)) {
+                               int poscnt = 0;
+
+                               line += 2;
+                               while (*line != 0) {
+                                       if (poscnt == 2 && *line == '/') {
+                                               *line = 0;
+                                               break;
+                                       }
+
+                                       if (*line == ' ') {
+                                               *line = 0;
+                                               poscnt++;
+
+                                               /* c=<network type> <address type> <connection address> */
+                                               if (poscnt == 2)
+                                                       sdpinfo.host = line + 1;
+
+                                               if (poscnt > 2)
+                                                       break;
+                                       }
+                                       line++;
+                               }
+                       } else if (!strncasecmp("m=", line, 2)) {
+                               int poscnt = 0;
+
+                               line += 2;
+                               while (*line != 0) {
+                                       if (*line == ' ') {
+                                               *line = 0;
+                                               poscnt++;
+
+                                               /* m=<media> <port> <transport> <fmt list> */
+                                               if (poscnt == 1)
+                                                       sdpinfo.port = line + 1;
+
+                                               if (poscnt == 2)
+                                                       sdpinfo.proto = line + 1;
+
+                                               if (poscnt > 2)
+                                                       break;
+                                       }
+                                       line++;
+                               }
+                       }
+
+                       line = ++pos;
+                       continue;
+               }
+               pos++;
+       }
+
+       return &sdpinfo;
+}
+
+