comparison src/network.h @ 8250:b248c1f4efbd

[gaim-migrate @ 8973] 1) Minor changes to the network listen code again. Tim, let me know if you have any other suggestions. 2) Changed how charsets are handled in oscar a tad bit. I think this should guarantee that Gaim doesn't crash when people send funky messages, or have funky away messages or really anything that is using a charset that isn't utf8, iso-8859-1, ucs-2be, or ascii. Ethan, this should fix the problem with that person's away message. Although, the message itself still looks kinda funky to me. The encoding is Windows-31J, which is apparently a valid iconv encoding? You would know more than I. 3) Fix the following crash: 1. IM yourself a message on AIM 2. Do NOT begin to type a second message, but instead hit CTRL+up committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 13 Feb 2004 05:37:12 +0000
parents fabcfd9a7c1c
children beb7be215db3
comparison
equal deleted inserted replaced
8249:b51ed4506180 8250:b248c1f4efbd
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 * Attempts to open a listening port ONLY on the specified port number. 91 * Attempts to open a listening port ONLY on the specified port number.
92 * You probably want to use gaim_network_listen_range() instead of this. 92 * You probably want to use gaim_network_listen_range() instead of this.
93 * This function is useful, for example, if you wanted to write a telnet 93 * This function is useful, for example, if you wanted to write a telnet
94 * server as a Gaim plugin, and you had to listen on port 23. Why anyone 94 * server as a Gaim plugin, and you HAD to listen on port 23. Why anyone
95 * would want to do that is beyond me. 95 * would want to do that is beyond me.
96 * 96 *
97 * This opens a listening port. The caller will want to set up a watcher 97 * This opens a listening port. The caller will want to set up a watcher
98 * of type GAIM_INPUT_READ on the returned fd. It will probably call 98 * of type GAIM_INPUT_READ on the returned fd. It will probably call
99 * accept in the callback, and then possibly remove the watcher and close 99 * accept in the callback, and then possibly remove the watcher and close
100 * the listening socket, and add a new watcher on the new socket accept 100 * the listening socket, and add a new watcher on the new socket accept
101 * returned. 101 * returned.
102 * 102 *
103 * @param port The port number to bind to. 103 * @param port The port number to bind to. Must be greater than 0.
104 * 104 *
105 * @return The file descriptor of the listening socket, or -1 if 105 * @return The file descriptor of the listening socket, or -1 if
106 * no socket could be established. 106 * no socket could be established.
107 */ 107 */
108 int gaim_network_listen(short port); 108 int gaim_network_listen(unsigned short port);
109 109
110 /** 110 /**
111 * Opens a listening port selected from a range of ports. The range of 111 * Opens a listening port selected from a range of ports. The range of
112 * ports used is chosen in the following manner: 112 * ports used is chosen in the following manner:
113 * If a range is specified in preferences, these values are used. 113 * If a range is specified in preferences, these values are used.
114 * If a non-0 values are passed to the function as parameters, these 114 * If a non-0 values are passed to the function as parameters, these
115 * values are used. 115 * values are used.
116 * Otherwise a port is chosen at random by the kernel. 116 * Otherwise a port is chosen at random by the kernel.
117 * 117 *
118 * This opens a listening port. The caller will want to set up a watcher 118 * This opens a listening port. The caller will want to set up a watcher
119 * of type GAIM_INPUT_READ on the returned fd. It will probably call 119 * of type GAIM_INPUT_READ on the returned fd. It will probably call
124 * @param start The port number to bind to, or 0 to pick a random port. 124 * @param start The port number to bind to, or 0 to pick a random port.
125 * Users are allowed to override this arg in prefs. 125 * Users are allowed to override this arg in prefs.
126 * @param end The highest possible port in the range of ports to listen on, 126 * @param end The highest possible port in the range of ports to listen on,
127 * or 0 to pick a random port. Users are allowed to override this 127 * or 0 to pick a random port. Users are allowed to override this
128 * arg in prefs. 128 * arg in prefs.
129 *
129 * @return The file descriptor of the listening socket, or -1 if 130 * @return The file descriptor of the listening socket, or -1 if
130 * no socket could be established. 131 * no socket could be established.
131 */ 132 */
132 int gaim_network_listen_range(short start, short end); 133 int gaim_network_listen_range(unsigned short start, unsigned short end);
133 134
134 /** 135 /**
135 * Gets a port number from a file descriptor. 136 * Gets a port number from a file descriptor.
136 * 137 *
137 * @param fd The file descriptor. This should be a tcp socket. The current 138 * @param fd The file descriptor. This should be a tcp socket. The current