comparison libfaim/aim_txqueue.c @ 840:595ac7759563

[gaim-migrate @ 850] lots of (mostly useless for us) libfaim changes. should help portability, but it was always portable between unices.... stupid win32ers. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 04 Sep 2000 23:37:32 +0000
parents e4c34ca88d9b
children e1da6a6ec42b
comparison
equal deleted inserted replaced
839:8f66e00af045 840:595ac7759563
17 * 17 *
18 * framing = AIM_FRAMETYPE_OFT/OSCAR 18 * framing = AIM_FRAMETYPE_OFT/OSCAR
19 * chan = channel for OSCAR, hdrtype for OFT 19 * chan = channel for OSCAR, hdrtype for OFT
20 * 20 *
21 */ 21 */
22 struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen) 22 faim_internal struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen)
23 { 23 {
24 struct command_tx_struct *new; 24 struct command_tx_struct *new;
25 25
26 if (!conn) { 26 if (!conn) {
27 printf("aim_tx_new: ERROR: no connection specified\n"); 27 printf("aim_tx_new: ERROR: no connection specified\n");
68 * 68 *
69 * Note that this is only used when doing queue-based transmitting; 69 * Note that this is only used when doing queue-based transmitting;
70 * that is, when sess->tx_enqueue is set to &aim_tx_enqueue__queuebased. 70 * that is, when sess->tx_enqueue is set to &aim_tx_enqueue__queuebased.
71 * 71 *
72 */ 72 */
73 int aim_tx_enqueue__queuebased(struct aim_session_t *sess, 73 faim_internal int aim_tx_enqueue__queuebased(struct aim_session_t *sess,
74 struct command_tx_struct *newpacket) 74 struct command_tx_struct *newpacket)
75 { 75 {
76 struct command_tx_struct *cur; 76 struct command_tx_struct *cur;
77 77
78 if (newpacket->conn == NULL) { 78 if (newpacket->conn == NULL) {
79 faimdprintf(1, "aim_tx_enqueue: WARNING: enqueueing packet with no connecetion\n"); 79 faimdprintf(1, "aim_tx_enqueue: WARNING: enqueueing packet with no connecetion\n");
120 * Basically the same as its __queuebased couterpart, however 120 * Basically the same as its __queuebased couterpart, however
121 * instead of doing a list append, it just calls aim_tx_sendframe() 121 * instead of doing a list append, it just calls aim_tx_sendframe()
122 * right here. 122 * right here.
123 * 123 *
124 */ 124 */
125 int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket) 125 faim_internal int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket)
126 { 126 {
127 if (newpacket->conn == NULL) { 127 if (newpacket->conn == NULL) {
128 faimdprintf(1, "aim_tx_enqueue: ERROR: packet has no connection\n"); 128 faimdprintf(1, "aim_tx_enqueue: ERROR: packet has no connection\n");
129 if (newpacket->data) 129 if (newpacket->data)
130 free(newpacket->data); 130 free(newpacket->data);
154 * that should be stamped on the next FLAP packet sent. This is 154 * that should be stamped on the next FLAP packet sent. This is
155 * normally called during the final step of packet preparation 155 * normally called during the final step of packet preparation
156 * before enqueuement (in aim_tx_enqueue()). 156 * before enqueuement (in aim_tx_enqueue()).
157 * 157 *
158 */ 158 */
159 u_int aim_get_next_txseqnum(struct aim_conn_t *conn) 159 faim_internal unsigned int aim_get_next_txseqnum(struct aim_conn_t *conn)
160 { 160 {
161 u_int ret; 161 u_int ret;
162 162
163 faim_mutex_lock(&conn->seqnum_lock); 163 faim_mutex_lock(&conn->seqnum_lock);
164 ret = ++conn->seqnum; 164 ret = ++conn->seqnum;
173 * records in the tx queue and their current status. Very helpful 173 * records in the tx queue and their current status. Very helpful
174 * if the queue isn't working quite right. 174 * if the queue isn't working quite right.
175 * 175 *
176 */ 176 */
177 #if debug == 2 177 #if debug == 2
178 int aim_tx_printqueue(struct aim_session_t *sess) 178 faim_internal int aim_tx_printqueue(struct aim_session_t *sess)
179 { 179 {
180 struct command_tx_struct *cur; 180 struct command_tx_struct *cur;
181 181
182 faimdprintf(2, "\ncurrent aim_queue_outgoing...\n"); 182 faimdprintf(2, "\ncurrent aim_queue_outgoing...\n");
183 faimdprintf(2, "\ttype seqnum len lock sent\n"); 183 faimdprintf(2, "\ttype seqnum len lock sent\n");
223 * 7) Unlock the struct. 223 * 7) Unlock the struct.
224 * 8) Free the temp buffer 224 * 8) Free the temp buffer
225 * 9) Step to next struct in list and go back to 1. 225 * 9) Step to next struct in list and go back to 1.
226 * 226 *
227 */ 227 */
228 int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur) 228 faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur)
229 { 229 {
230 int buflen = 0; 230 int buflen = 0;
231 unsigned char *curPacket; 231 unsigned char *curPacket;
232 232
233 if (!cur) 233 if (!cur)
325 free(curPacket); /* free up full-packet buffer */ 325 free(curPacket); /* free up full-packet buffer */
326 326
327 return 1; /* success */ 327 return 1; /* success */
328 } 328 }
329 329
330 int aim_tx_flushqueue(struct aim_session_t *sess) 330 faim_export int aim_tx_flushqueue(struct aim_session_t *sess)
331 { 331 {
332 struct command_tx_struct *cur; 332 struct command_tx_struct *cur;
333 333
334 #if debug > 1 334 #if debug > 1
335 int i = 0; 335 int i = 0;
369 * This is responsable for removing sent commands from the transmit 369 * This is responsable for removing sent commands from the transmit
370 * queue. This is not a required operation, but it of course helps 370 * queue. This is not a required operation, but it of course helps
371 * reduce memory footprint at run time! 371 * reduce memory footprint at run time!
372 * 372 *
373 */ 373 */
374 void aim_tx_purgequeue(struct aim_session_t *sess) 374 faim_export void aim_tx_purgequeue(struct aim_session_t *sess)
375 { 375 {
376 struct command_tx_struct *cur = NULL; 376 struct command_tx_struct *cur = NULL;
377 struct command_tx_struct *tmp; 377 struct command_tx_struct *tmp;
378 378
379 if (sess->queue_outgoing == NULL) 379 if (sess->queue_outgoing == NULL)