All pastes #19451 Raw Edit

Unnamed

public text v1 · immutable
#19451 ·published 2005-08-06 19:29 UTC
rendered paste body
int sangoma_create_socket_intr(int span, int intr)
{
    struct wan_sockaddr_ll  sa;
    int sock=-1, i=0;

    memset(&sa, 0, sizeof(struct wan_sockaddr_ll));
    sock = socket(AF_WANPIPE, SOCK_RAW, 0);
    if ( sock >= 0 ) {
        sprintf(sa.sll_device, "w%dg%d", span, i);
        //strcpy( sa.sll_card, "wanpipe1");
        sprintf(sa.sll_card, "wanpipe%d",span);
        sa.sll_protocol = htons(PVC_PROT);
        sa.sll_family=AF_WANPIPE;

        if (bind(sock, (struct sockaddr *)&sa, sizeof(struct wan_sockaddr_ll))) {
            close(sock);
            sock = -1;
            printf("Fail %d %s\n", sock, sa.sll_device);
        }

    }


    return sock;
}