comparison src/network.h @ 8246:e7524f4b4ed2

[gaim-migrate @ 8969] Change some listening stuff. Also, the autorecon thing, the signals should get removed when the hash table is destroyed, so that check should not be necessary. If the function really is getting called then I guess this should be re-added or something... committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 12 Feb 2004 20:58:36 +0000
parents 609a62b8e748
children fabcfd9a7c1c
comparison
equal deleted inserted replaced
8245:91c6629b1ee8 8246:e7524f4b4ed2
86 * @return The local IP address to be used. 86 * @return The local IP address to be used.
87 */ 87 */
88 const char *gaim_network_get_ip_for_account(const GaimAccount *account, int fd); 88 const char *gaim_network_get_ip_for_account(const GaimAccount *account, int fd);
89 89
90 /** 90 /**
91 * Opens a listening port. 91 * Attempts to open a listening port ONLY on the specified port number.
92 * Can be used if MUST be listening on a certain port. You probably
93 * want to use gaim_network_listen_range() instead of this.
92 * 94 *
93 * This opens a listening port. The caller will want to set up a watcher 95 * This opens a listening port. The caller will want to set up a watcher
94 * of type GAIM_INPUT_READ on the returned fd. It will probably call 96 * of type GAIM_INPUT_READ on the returned fd. It will probably call
95 * accept in the callback, and then possibly remove the watcher and close 97 * accept in the callback, and then possibly remove the watcher and close
96 * the listening socket, and add a new watcher on the new socket accept 98 * the listening socket, and add a new watcher on the new socket accept
97 * returned. 99 * returned.
98 * 100 *
99 * @param start The port number to bind to, or 0 to let the core decide. 101 * @param port The port number to bind to.
100 * By default, the core will let the kernel pick one at random, 102 *
101 * but users are allowed to specify a range. 103 * @return The file descriptor of the listening socket, or -1 if
102 * @param end The highest possible port in the range of ports to listen on,
103 * or 0 to let the core decide.
104 * @return The file descriptor of the listening socket, or -1 if
105 * no socket could be established. 104 * no socket could be established.
106 */ 105 */
107 int gaim_network_listen(short start, short end); 106 int gaim_network_listen(short port);
107
108 /**
109 * Opens a listening port selected from a range of ports.
110 *
111 * This opens a listening port. The caller will want to set up a watcher
112 * of type GAIM_INPUT_READ on the returned fd. It will probably call
113 * accept in the callback, and then possibly remove the watcher and close
114 * the listening socket, and add a new watcher on the new socket accept
115 * returned.
116 *
117 * @note This function always lets the core override its args with the
118 * value of the user preferences.
119 *
120 * @param start The port number to bind to, or 0 to let the core decide.
121 * By default, the core will let the kernel pick one at random.
122 * Users are allowed to override this arg in prefs.
123 * @param end The highest possible port in the range of ports to listen on,
124 * or 0 to let the core decide Users are allowed to override this
125 * arg in prefs.
126 * @return The file descriptor of the listening socket, or -1 if
127 * no socket could be established.
128 */
129 int gaim_network_listen_range(short start, short end);
108 130
109 /** 131 /**
110 * Gets a port number from a file descriptor. 132 * Gets a port number from a file descriptor.
111 * 133 *
112 * @param fd The file descriptor. This should be a tcp socket. The current 134 * @param fd The file descriptor. This should be a tcp socket. The current