src/sock_tcp.h
changeset 3 cc94ae754e2a
parent 2 a834f0559939
child 10 9fe218576d13
equal deleted inserted replaced
2:a834f0559939 3:cc94ae754e2a
    16     /* The OS file descriptor */
    16     /* The OS file descriptor */
    17     int fd;
    17     int fd;
    18 };
    18 };
    19 
    19 
    20 #define SOCK_TCP_BASE(sock_ptr) (&(sock_ptr)->base)
    20 #define SOCK_TCP_BASE(sock_ptr) (&(sock_ptr)->base)
       
    21 #define SOCK_TCP_ERR(sock_ptr) SOCK_ERR(SOCK_TCP_BASE(sock_ptr))
    21 
    22 
    22 /*
    23 /*
    23  * Allocate a new blank sock_tcp with a correctly initialized base
    24  * Allocate a new blank sock_tcp with a correctly initialized base
    24  */
    25  */
    25 struct sock_tcp* sock_tcp_alloc (void);
    26 err_t sock_tcp_alloc (struct sock_tcp **sock_ptr);
    26 
    27 
    27 /*
    28 /*
    28  * Initialize a blank sock_tcp with a given already-existing fd
    29  * Initialize a blank sock_tcp with a given already-existing fd
    29  */
    30  */
    30 int sock_tcp_init_fd (struct sock_tcp *sock, int fd);
    31 err_t sock_tcp_init_fd (struct sock_tcp *sock, int fd);
    31 
    32 
    32 /*
    33 /*
    33  * Initialize a blank sock_tcp by connecting
    34  * Initialize a blank sock_tcp by connecting
    34  */
    35  */
    35 int sock_tcp_init_connect (struct sock_tcp *sock, const char *hostname, const char *service);
    36 err_t sock_tcp_init_connect (struct sock_tcp *sock, const char *hostname, const char *service);
       
    37 
       
    38 /*
       
    39  * Release a non-connected sock_tcp
       
    40  */
       
    41 void sock_tcp_release (struct sock_tcp *sock);
    36 
    42 
    37 #endif /* SOCK_TCP_H */
    43 #endif /* SOCK_TCP_H */