comparison src/network.h @ 12730:d5b8f4dc1622

[gaim-migrate @ 15074] Update gaim_network_listen*() to have the socket type specified. This allows us to use the same functionality to listen on UDP sockets too. There are probably a couple things that should be updated to use this. I also updated SIMPLE to allow the connect port to be specified in the account options. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 05 Jan 2006 05:04:07 +0000
parents 9c5a2f0bb32c
children 8e3b85fe4a55
comparison
equal deleted inserted replaced
12729:d3232d64fafd 12730:d5b8f4dc1622
113 * accept in the callback, and then possibly remove the watcher and close 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 114 * the listening socket, and add a new watcher on the new socket accept
115 * returned. 115 * returned.
116 * 116 *
117 * @param port The port number to bind to. Must be greater than 0. 117 * @param port The port number to bind to. Must be greater than 0.
118 * @param socket_type The type of socket to open for listening.
119 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
118 * 120 *
119 * @return The file descriptor of the listening socket, or -1 if 121 * @return The file descriptor of the listening socket, or -1 if
120 * no socket could be established. 122 * no socket could be established.
121 */ 123 */
122 int gaim_network_listen(unsigned short port); 124 int gaim_network_listen(unsigned short port, int socket_type);
123 125
124 /** 126 /**
125 * Opens a listening port selected from a range of ports. The range of 127 * Opens a listening port selected from a range of ports. The range of
126 * ports used is chosen in the following manner: 128 * ports used is chosen in the following manner:
127 * If a range is specified in preferences, these values are used. 129 * If a range is specified in preferences, these values are used.
138 * @param start The port number to bind to, or 0 to pick a random port. 140 * @param start The port number to bind to, or 0 to pick a random port.
139 * Users are allowed to override this arg in prefs. 141 * Users are allowed to override this arg in prefs.
140 * @param end The highest possible port in the range of ports to listen on, 142 * @param end The highest possible port in the range of ports to listen on,
141 * or 0 to pick a random port. Users are allowed to override this 143 * or 0 to pick a random port. Users are allowed to override this
142 * arg in prefs. 144 * arg in prefs.
145 * @param socket_type The type of socket to open for listening.
146 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
143 * 147 *
144 * @return The file descriptor of the listening socket, or -1 if 148 * @return The file descriptor of the listening socket, or -1 if
145 * no socket could be established. 149 * no socket could be established.
146 */ 150 */
147 int gaim_network_listen_range(unsigned short start, unsigned short end); 151 int gaim_network_listen_range(unsigned short start, unsigned short end,
152 int socket_type);
148 153
149 /** 154 /**
150 * Gets a port number from a file descriptor. 155 * Gets a port number from a file descriptor.
151 * 156 *
152 * @param fd The file descriptor. This should be a tcp socket. The current 157 * @param fd The file descriptor. This should be a tcp socket. The current