void net_slirp_hostfwd_remove(Monitor *mon, const char *src_str)

{

    struct in_addr host_addr = { .s_addr = INADDR_ANY };

    int host_port;

    char buf[256] = "";

    const char *p = src_str;

    int is_udp = 0;

    int n;



    if (!slirp_inited) {

        monitor_printf(mon, "user mode network stack not in use\n");

        return;

    }



    if (!src_str || !src_str[0])

        goto fail_syntax;



    get_str_sep(buf, sizeof(buf), &p, ':');



    if (!strcmp(buf, "tcp") || buf[0] == '\0') {

        is_udp = 0;

    } else if (!strcmp(buf, "udp")) {

        is_udp = 1;

    } else {

        goto fail_syntax;

    }



    if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {

        goto fail_syntax;

    }

    if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) {

        goto fail_syntax;

    }



    host_port = atoi(p);



    n = slirp_remove_hostfwd(is_udp, host_addr, host_port);



    monitor_printf(mon, "removed %d host forwarding rules for %s\n", n,

                   src_str);

    return;



 fail_syntax:

    monitor_printf(mon, "invalid format\n");

}

void net_slirp_hostfwd_remove(Monitor *mon, const char *src_str)

{

    struct in_addr host_addr = { .s_addr = INADDR_ANY };

    int host_port;

    char buf[256] = "";

    const char *p = src_str;

    int is_udp = 0;

    int n;



    if (!slirp_inited) {

        monitor_printf(mon, "user mode network stack not in use\n");

        return;

    }



    if (!src_str || !src_str[0])

        goto fail_syntax;



    get_str_sep(buf, sizeof(buf), &p, ':');



    if (!strcmp(buf, "tcp") || buf[0] == '\0') {

        is_udp = 0;

    } else if (!strcmp(buf, "udp")) {

        is_udp = 1;

    } else {

        goto fail_syntax;

    }



    if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {

        goto fail_syntax;

    }

    if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) {

        goto fail_syntax;

    }



    host_port = atoi(p);



    n = slirp_remove_hostfwd(is_udp, host_addr, host_port);



    monitor_printf(mon, "removed %d host forwarding rules for %s\n", n,

                   src_str);

    return;



 fail_syntax:

    monitor_printf(mon, "invalid format\n");

}

void FUNC_0(Monitor *VAR_0, const char *VAR_1)

{

    struct in_addr VAR_2 = { .s_addr = INADDR_ANY };

    int VAR_3;

    char VAR_4[256] = "";

    const char *VAR_5 = VAR_1;

    int VAR_6 = 0;

    int VAR_7;



    if (!slirp_inited) {

        monitor_printf(VAR_0, "user mode network stack not in use\VAR_7");

        return;

    }



    if (!VAR_1 || !VAR_1[0])

        goto fail_syntax;



    get_str_sep(VAR_4, sizeof(VAR_4), &VAR_5, ':');



    if (!strcmp(VAR_4, "tcp") || VAR_4[0] == '\0') {

        VAR_6 = 0;

    } else if (!strcmp(VAR_4, "udp")) {

        VAR_6 = 1;

    } else {

        goto fail_syntax;

    }



    if (get_str_sep(VAR_4, sizeof(VAR_4), &VAR_5, ':') < 0) {

        goto fail_syntax;

    }

    if (VAR_4[0] != '\0' && !inet_aton(VAR_4, &VAR_2)) {

        goto fail_syntax;

    }



    VAR_3 = atoi(VAR_5);



    VAR_7 = slirp_remove_hostfwd(VAR_6, VAR_2, VAR_3);



    monitor_printf(VAR_0, "removed %d host forwarding rules for %s\VAR_7", VAR_7,

                   VAR_1);

    return;



 fail_syntax:

    monitor_printf(VAR_0, "invalid format\VAR_7");

}

void FUNC_0(Monitor *VAR_0, const char *VAR_1)
{ struct in_addr VAR_2 = { .s_addr = INADDR_ANY }; int VAR_3; char VAR_4[256] = ""; const char *VAR_5 = VAR_1; int VAR_6 = 0; int VAR_7; if (!slirp_inited) { monitor_printf(VAR_0, "user mode network stack not in use\VAR_7"); return; } if (!VAR_1 || !VAR_1[0])
goto fail_syntax; get_str_sep(VAR_4, sizeof(VAR_4), &VAR_5, ':'); if (!strcmp(VAR_4, "tcp") || VAR_4[0] == '\0') { VAR_6 = 0; } else if (!strcmp(VAR_4, "udp")) { VAR_6 = 1; } else { goto fail_syntax; } if (get_str_sep(VAR_4, sizeof(VAR_4), &VAR_5, ':') < 0) { goto fail_syntax; } if (VAR_4[0] != '\0' && !inet_aton(VAR_4, &VAR_2)) { goto fail_syntax; } VAR_3 = atoi(VAR_5); VAR_7 = slirp_remove_hostfwd(VAR_6, VAR_2, VAR_3); monitor_printf(VAR_0, "removed %d host forwarding rules for %s\VAR_7", VAR_7,
VAR_1); return; fail_syntax:
monitor_printf(VAR_0, "invalid format\VAR_7"); }