STCP/mysock_api.c
int mybind(mysocket_t sd, struct sockaddr *addr, int addrlen)
{
    mysock_context_t *ctx = _mysock_get_context(sd);
    assert(addr);

    MYSOCK_CHECK(ctx != NULL, EBADF);
    MYSOCK_CHECK(addr->sa_family == AF_INET, EADDRNOTAVAIL);

    /* mybind() must precede mylisten() */
    assert(!ctx->listening);
    ctx->bound = TRUE;
    ctx->network_state.local_addr = *addr;
    return _network_bind(&ctx->network_state, addr, addrlen);
}
/* simply a wrapper around bind() */
simply a wrapper around bind()
simply a wrapper around bind ()
int mybind(mysocket_t sd, struct sockaddr *addr, int addrlen)
{
    mysock_context_t *ctx = _mysock_get_context(sd);
    assert(addr);
    MYSOCK_CHECK(ctx != NULL, EBADF);
    MYSOCK_CHECK(addr->sa_family == AF_INET, EADDRNOTAVAIL);
    assert(!ctx->listening);
    ctx->bound = TRUE;
    ctx->network_state.local_addr = *addr;
    return _network_bind(&ctx->network_state, addr, addrlen);
}
int mybind ( mysocket_t sd , struct sockaddr * addr , int addrlen ) { mysock_context_t * ctx = _mysock_get_context ( sd ) ; assert ( addr ) ; MYSOCK_CHECK ( ctx != NULL , EBADF ) ; MYSOCK_CHECK ( addr -> sa_family == AF_INET , EADDRNOTAVAIL ) ; assert ( ! ctx -> listening ) ; ctx -> bound = TRUE ; ctx -> network_state . local_addr = * addr ; return _network_bind ( & ctx -> network_state , addr , addrlen ) ; }
simply a wrapper around bind()
simply a wrapper around bind ()
/* mybind() must precede mylisten() */