+int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rp, const char *msg)
+{
+ int r;
+
+ assert (rp);
+ r = cs_put (p->cs_link, rp->buf_out, rp->len_out);
+ if (r < 0)
+ return TCL_ERROR;
+ else if (r == 1)
+ {
+ ir_select_add_write (cs_fileno (p->cs_link), p);
+ logf (LOG_DEBUG, "Send part of %s", msg);
+ p->state = IR_TCL_R_Writing;
+ }
+ else
+ {
+ logf (LOG_DEBUG, "Send %s (%d bytes)", msg, rp->len_out);
+ p->state = IR_TCL_R_Waiting;
+ free (rp->buf_out);
+ rp->buf_out = NULL;
+ }
+ return TCL_OK;
+}
+
+void ir_tcl_del_q (IrTcl_Obj *p)
+{
+ IrTcl_Request *rp, *rp1;
+
+ for (rp = p->request_queue; rp; rp = rp1)
+ {
+ free (rp->object_name);
+ free (rp->callback);
+ free (rp->buf_out);
+ rp1 = rp->next;
+ free (rp);
+ }
+ p->request_queue = NULL;
+}
+
+
+