X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;ds=sidebyside;f=network.h;h=528e92ab571f039eae01a8f08e411d7865dad4c9;hb=9b15a8010102fc83dcd7eef78014a65f11619d63;hp=71fe333bd677a80f50dcadb3c65fbd95e75658b4;hpb=988c1974eaedada55de08752d86e7c16a30e11e5;p=PuTTY.git diff --git a/network.h b/network.h index 71fe333b..528e92ab 100644 --- a/network.h +++ b/network.h @@ -8,14 +8,31 @@ * send data without having to worry about blocking. The stuff * behind the abstraction takes care of selects and nonblocking * writes and all that sort of painful gubbins. - * - * If urgent data comes in on a socket, the back end will read and - * discard up to the urgent pointer, then read the urgent byte and - * send _that_ to the receiver function with `urgent' set. */ +#ifndef PUTTY_NETWORK_H +#define PUTTY_NETWORK_H + typedef struct Socket_tag *Socket; typedef struct SockAddr_tag *SockAddr; + +/* + * This is the function a client must register with each socket, to + * receive data coming in on that socket. The parameter `urgent' + * decides the meaning of `data' and `len': + * + * - urgent==0. `data' points to `len' bytes of perfectly ordinary + * data. + * + * - urgent==1. `data' points to `len' bytes of data, which were + * read from before an Urgent pointer. + * + * - urgent==2. `data' points to `len' bytes of data, the first of + * which was the one at the Urgent mark. + * + * - urgent==3. An error has occurred on the socket. `data' points + * to an error string, and `len' points to an error code. + */ typedef int (*sk_receiver_t)(Socket s, int urgent, char *data, int len); void sk_init(void); /* called once at program startup */ @@ -23,7 +40,7 @@ void sk_init(void); /* called once at program startup */ SockAddr sk_namelookup(char *host, char **canonicalname); void sk_addr_free(SockAddr addr); -Socket sk_new(SockAddr addr, int port, sk_receiver_t receiver); +Socket sk_new(SockAddr addr, int port, int privport, sk_receiver_t receiver); void sk_close(Socket s); void sk_write(Socket s, char *buf, int len); void sk_write_oob(Socket s, char *buf, int len); @@ -42,3 +59,5 @@ void *sk_get_private_ptr(Socket s); */ char *sk_addr_error(SockAddr addr); char *sk_socket_error(Socket addr); + +#endif