4 #include <exec/libraries.h>
5 #include <libraries/commodities.h>
6 #include <proto/commodities.h>
7 #include <proto/exec.h>
8 #include <kern/amiga_cx.h>
9 #include <kern/amiga_gui.h>
11 extern UBYTE
*REXX_PORT_NAME
;
12 extern struct Task
*AROSTCP_Task
;
13 extern struct Library
*SocketBase
;
15 struct Library
*CxBase
= NULL
;
16 static CxObj
*Broker
= NULL
;
18 struct NewBroker nb
= {
22 "The opensource TCP/IP stack",
33 if (CxBase
= OpenLibrary("commodities.library", 0L)) {
34 nb
.nb_Port
= CreateMsgPort();
36 nb
.nb_Name
= REXX_PORT_NAME
;
37 return (ULONG
)1 << nb
.nb_Port
->mp_SigBit
;
47 if (!Broker
&& nb
.nb_Port
) {
48 Broker
= CxBroker(&nb
, NULL
);
50 ActivateCxObj(Broker
, 1);
63 * Remove the broker from the system
66 /* Empty the message port */
67 while (msg
= GetMsg(nb
.nb_Port
))
79 DeleteMsgPort(nb
.nb_Port
);
92 if (msg
= (CxMsg
*)GetMsg(nb
.nb_Port
)) {
94 msgtype
= CxMsgType(msg
);
95 ReplyMsg((struct Message
*)msg
);
97 if (msgtype
== CXM_COMMAND
) {
98 /* Commodities has sent a command */
107 case CXCMD_DISAPPEAR
:
111 /* user clicked Remove button, let's quit */
112 Signal(AROSTCP_Task
, SIGBREAKF_CTRL_C
);