static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)

{

    char transport_protocol[16];

    char profile[16];

    char lower_transport[16];

    char parameter[16];

    RTSPTransportField *th;

    char buf[256];



    reply->nb_transports = 0;



    for(;;) {

        skip_spaces(&p);

        if (*p == '\0')

            break;



        th = &reply->transports[reply->nb_transports];



        get_word_sep(transport_protocol, sizeof(transport_protocol),

                     "/", &p);

        if (!strcasecmp (transport_protocol, "rtp")) {

            get_word_sep(profile, sizeof(profile), "/;,", &p);

            lower_transport[0] = '\0';

            /* rtp/avp/<protocol> */

            if (*p == '/') {

                get_word_sep(lower_transport, sizeof(lower_transport),

                             ";,", &p);

            }

            th->transport = RTSP_TRANSPORT_RTP;

        } else if (!strcasecmp (transport_protocol, "x-pn-tng") ||

                   !strcasecmp (transport_protocol, "x-real-rdt")) {

            /* x-pn-tng/<protocol> */

            get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p);

            profile[0] = '\0';

            th->transport = RTSP_TRANSPORT_RDT;

        }

        if (!strcasecmp(lower_transport, "TCP"))

            th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;

        else

            th->lower_transport = RTSP_LOWER_TRANSPORT_UDP;



        if (*p == ';')

            p++;

        /* get each parameter */

        while (*p != '\0' && *p != ',') {

            get_word_sep(parameter, sizeof(parameter), "=;,", &p);

            if (!strcmp(parameter, "port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->port_min, &th->port_max, &p);

                }

            } else if (!strcmp(parameter, "client_port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->client_port_min,

                                     &th->client_port_max, &p);

                }

            } else if (!strcmp(parameter, "server_port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->server_port_min,

                                     &th->server_port_max, &p);

                }

            } else if (!strcmp(parameter, "interleaved")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->interleaved_min,

                                     &th->interleaved_max, &p);

                }

            } else if (!strcmp(parameter, "multicast")) {

                if (th->lower_transport == RTSP_LOWER_TRANSPORT_UDP)

                    th->lower_transport = RTSP_LOWER_TRANSPORT_UDP_MULTICAST;

            } else if (!strcmp(parameter, "ttl")) {

                if (*p == '=') {

                    p++;

                    th->ttl = strtol(p, (char **)&p, 10);

                }

            } else if (!strcmp(parameter, "destination")) {

                struct in_addr ipaddr;



                if (*p == '=') {

                    p++;

                    get_word_sep(buf, sizeof(buf), ";,", &p);

                    if (inet_aton(buf, &ipaddr))

                        th->destination = ntohl(ipaddr.s_addr);

                }

            }

            while (*p != ';' && *p != '\0' && *p != ',')

                p++;

            if (*p == ';')

                p++;

        }

        if (*p == ',')

            p++;



        reply->nb_transports++;

    }

}

static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)

{

    char transport_protocol[16];

    char profile[16];

    char lower_transport[16];

    char parameter[16];

    RTSPTransportField *th;

    char buf[256];



    reply->nb_transports = 0;



    for(;;) {

        skip_spaces(&p);

        if (*p == '\0')

            break;



        th = &reply->transports[reply->nb_transports];



        get_word_sep(transport_protocol, sizeof(transport_protocol),

                     "/", &p);

        if (!strcasecmp (transport_protocol, "rtp")) {

            get_word_sep(profile, sizeof(profile), "/;,", &p);

            lower_transport[0] = '\0';

            

            if (*p == '/') {

                get_word_sep(lower_transport, sizeof(lower_transport),

                             ";,", &p);

            }

            th->transport = RTSP_TRANSPORT_RTP;

        } else if (!strcasecmp (transport_protocol, "x-pn-tng") ||

                   !strcasecmp (transport_protocol, "x-real-rdt")) {

            

            get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p);

            profile[0] = '\0';

            th->transport = RTSP_TRANSPORT_RDT;

        }

        if (!strcasecmp(lower_transport, "TCP"))

            th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;

        else

            th->lower_transport = RTSP_LOWER_TRANSPORT_UDP;



        if (*p == ';')

            p++;

        

        while (*p != '\0' && *p != ',') {

            get_word_sep(parameter, sizeof(parameter), "=;,", &p);

            if (!strcmp(parameter, "port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->port_min, &th->port_max, &p);

                }

            } else if (!strcmp(parameter, "client_port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->client_port_min,

                                     &th->client_port_max, &p);

                }

            } else if (!strcmp(parameter, "server_port")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->server_port_min,

                                     &th->server_port_max, &p);

                }

            } else if (!strcmp(parameter, "interleaved")) {

                if (*p == '=') {

                    p++;

                    rtsp_parse_range(&th->interleaved_min,

                                     &th->interleaved_max, &p);

                }

            } else if (!strcmp(parameter, "multicast")) {

                if (th->lower_transport == RTSP_LOWER_TRANSPORT_UDP)

                    th->lower_transport = RTSP_LOWER_TRANSPORT_UDP_MULTICAST;

            } else if (!strcmp(parameter, "ttl")) {

                if (*p == '=') {

                    p++;

                    th->ttl = strtol(p, (char **)&p, 10);

                }

            } else if (!strcmp(parameter, "destination")) {

                struct in_addr ipaddr;



                if (*p == '=') {

                    p++;

                    get_word_sep(buf, sizeof(buf), ";,", &p);

                    if (inet_aton(buf, &ipaddr))

                        th->destination = ntohl(ipaddr.s_addr);

                }

            }

            while (*p != ';' && *p != '\0' && *p != ',')

                p++;

            if (*p == ';')

                p++;

        }

        if (*p == ',')

            p++;



        reply->nb_transports++;

    }

}

static void FUNC_0(RTSPMessageHeader *VAR_0, const char *VAR_1)

{

    char VAR_2[16];

    char VAR_3[16];

    char VAR_4[16];

    char VAR_5[16];

    RTSPTransportField *th;

    char VAR_6[256];



    VAR_0->nb_transports = 0;



    for(;;) {

        skip_spaces(&VAR_1);

        if (*VAR_1 == '\0')

            break;



        th = &VAR_0->transports[VAR_0->nb_transports];



        get_word_sep(VAR_2, sizeof(VAR_2),

                     "/", &VAR_1);

        if (!strcasecmp (VAR_2, "rtp")) {

            get_word_sep(VAR_3, sizeof(VAR_3), "/;,", &VAR_1);

            VAR_4[0] = '\0';

            

            if (*VAR_1 == '/') {

                get_word_sep(VAR_4, sizeof(VAR_4),

                             ";,", &VAR_1);

            }

            th->transport = RTSP_TRANSPORT_RTP;

        } else if (!strcasecmp (VAR_2, "x-pn-tng") ||

                   !strcasecmp (VAR_2, "x-real-rdt")) {

            

            get_word_sep(VAR_4, sizeof(VAR_4), "/;,", &VAR_1);

            VAR_3[0] = '\0';

            th->transport = RTSP_TRANSPORT_RDT;

        }

        if (!strcasecmp(VAR_4, "TCP"))

            th->VAR_4 = RTSP_LOWER_TRANSPORT_TCP;

        else

            th->VAR_4 = RTSP_LOWER_TRANSPORT_UDP;



        if (*VAR_1 == ';')

            VAR_1++;

        

        while (*VAR_1 != '\0' && *VAR_1 != ',') {

            get_word_sep(VAR_5, sizeof(VAR_5), "=;,", &VAR_1);

            if (!strcmp(VAR_5, "port")) {

                if (*VAR_1 == '=') {

                    VAR_1++;

                    rtsp_parse_range(&th->port_min, &th->port_max, &VAR_1);

                }

            } else if (!strcmp(VAR_5, "client_port")) {

                if (*VAR_1 == '=') {

                    VAR_1++;

                    rtsp_parse_range(&th->client_port_min,

                                     &th->client_port_max, &VAR_1);

                }

            } else if (!strcmp(VAR_5, "server_port")) {

                if (*VAR_1 == '=') {

                    VAR_1++;

                    rtsp_parse_range(&th->server_port_min,

                                     &th->server_port_max, &VAR_1);

                }

            } else if (!strcmp(VAR_5, "interleaved")) {

                if (*VAR_1 == '=') {

                    VAR_1++;

                    rtsp_parse_range(&th->interleaved_min,

                                     &th->interleaved_max, &VAR_1);

                }

            } else if (!strcmp(VAR_5, "multicast")) {

                if (th->VAR_4 == RTSP_LOWER_TRANSPORT_UDP)

                    th->VAR_4 = RTSP_LOWER_TRANSPORT_UDP_MULTICAST;

            } else if (!strcmp(VAR_5, "ttl")) {

                if (*VAR_1 == '=') {

                    VAR_1++;

                    th->ttl = strtol(VAR_1, (char **)&VAR_1, 10);

                }

            } else if (!strcmp(VAR_5, "destination")) {

                struct in_addr VAR_7;



                if (*VAR_1 == '=') {

                    VAR_1++;

                    get_word_sep(VAR_6, sizeof(VAR_6), ";,", &VAR_1);

                    if (inet_aton(VAR_6, &VAR_7))

                        th->destination = ntohl(VAR_7.s_addr);

                }

            }

            while (*VAR_1 != ';' && *VAR_1 != '\0' && *VAR_1 != ',')

                VAR_1++;

            if (*VAR_1 == ';')

                VAR_1++;

        }

        if (*VAR_1 == ',')

            VAR_1++;



        VAR_0->nb_transports++;

    }

}

static void FUNC_0(RTSPMessageHeader *VAR_0, const char *VAR_1)
{ char VAR_2[16]; char VAR_3[16]; char VAR_4[16]; char VAR_5[16]; RTSPTransportField *th; char VAR_6[256]; VAR_0->nb_transports = 0; for(;;) { skip_spaces(&VAR_1); if (*VAR_1 == '\0')
break; th = &VAR_0->transports[VAR_0->nb_transports]; get_word_sep(VAR_2, sizeof(VAR_2),
"/", &VAR_1); if (!strcasecmp (VAR_2, "rtp")) { get_word_sep(VAR_3, sizeof(VAR_3), "/;,", &VAR_1); VAR_4[0] = '\0'; if (*VAR_1 == '/') { get_word_sep(VAR_4, sizeof(VAR_4),
";,", &VAR_1); } th->transport = RTSP_TRANSPORT_RTP; } else if (!strcasecmp (VAR_2, "x-pn-tng") || !strcasecmp (VAR_2, "x-real-rdt")) { get_word_sep(VAR_4, sizeof(VAR_4), "/;,", &VAR_1); VAR_3[0] = '\0'; th->transport = RTSP_TRANSPORT_RDT; } if (!strcasecmp(VAR_4, "TCP"))
th->VAR_4 = RTSP_LOWER_TRANSPORT_TCP; else
th->VAR_4 = RTSP_LOWER_TRANSPORT_UDP; if (*VAR_1 == ';') VAR_1++; while (*VAR_1 != '\0' && *VAR_1 != ',') { get_word_sep(VAR_5, sizeof(VAR_5), "=;,", &VAR_1); if (!strcmp(VAR_5, "port")) { if (*VAR_1 == '=') { VAR_1++; rtsp_parse_range(&th->port_min, &th->port_max, &VAR_1); } } else if (!strcmp(VAR_5, "client_port")) { if (*VAR_1 == '=') { VAR_1++; rtsp_parse_range(&th->client_port_min,
&th->client_port_max, &VAR_1); } } else if (!strcmp(VAR_5, "server_port")) { if (*VAR_1 == '=') { VAR_1++; rtsp_parse_range(&th->server_port_min,
&th->server_port_max, &VAR_1); } } else if (!strcmp(VAR_5, "interleaved")) { if (*VAR_1 == '=') { VAR_1++; rtsp_parse_range(&th->interleaved_min,
&th->interleaved_max, &VAR_1); } } else if (!strcmp(VAR_5, "multicast")) { if (th->VAR_4 == RTSP_LOWER_TRANSPORT_UDP)
th->VAR_4 = RTSP_LOWER_TRANSPORT_UDP_MULTICAST; } else if (!strcmp(VAR_5, "ttl")) { if (*VAR_1 == '=') { VAR_1++; th->ttl = strtol(VAR_1, (char **)&VAR_1, 10); } } else if (!strcmp(VAR_5, "destination")) { struct in_addr VAR_7; if (*VAR_1 == '=') { VAR_1++; get_word_sep(VAR_6, sizeof(VAR_6), ";,", &VAR_1); if (inet_aton(VAR_6, &VAR_7))
th->destination = ntohl(VAR_7.s_addr); } } while (*VAR_1 != ';' && *VAR_1 != '\0' && *VAR_1 != ',') VAR_1++; if (*VAR_1 == ';') VAR_1++; } if (*VAR_1 == ',')
VAR_1++; VAR_0->nb_transports++; } }