2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
5 Desc: Add a server to the list of public servers
8 #include <exec/lists.h>
9 #include <exec/memory.h>
10 #include <proto/exec.h>
12 #include <aros/debug.h>
15 /*****************************************************************************
18 #include <proto/oop.h>
20 AROS_LH2(BOOL
, OOP_AddServer
,
23 AROS_LHA(OOP_Object
*, serverPtr
, A0
),
24 AROS_LHA(STRPTR
, serverID
, A1
),
27 struct Library
*, OOPBase
, 12, OOP
)
30 Adds a server object to to the list of public servers.
31 Other processes might then obtain a pointer to the server,
32 and use the server to obtain proxies for objects the
36 serverPtr - Pointer to a valid server object.
37 serverID - ID that identifies the server.
40 TRUE if successful, FALSE otherwise.
43 Probably not a good API. Implemented
44 just to show how one can call methods
45 across process-borders.
52 OOP_FindServer(), OOP_RemoveServer()
57 29-10-95 digulla automatically created from
58 intuition_lib.fd and clib/intuition_protos.h
60 *****************************************************************************/
64 EnterFunc(bug("OOP_AddServer(server=%p, serverID=%s)\n",
65 serverPtr
, serverID
));
67 if (serverPtr
&& serverID
)
69 struct ServerNode
*sn
;
71 /* Allocate a listnode, so we can add the server to the list.
72 ** If objects have a node by default, then this won't be necessary.
74 sn
= AllocMem(sizeof (struct ServerNode
), MEMF_PUBLIC
);
78 sn
->sn_Node
.ln_Name
= AllocVec(strlen (serverID
) + 1, MEMF_ANY
);
79 if (sn
->sn_Node
.ln_Name
)
81 sn
->sn_Server
= serverPtr
;
83 strcpy(sn
->sn_Node
.ln_Name
, serverID
);
85 ObtainSemaphore( &GetOBase(OOPBase
)->ob_ServerListLock
);
87 AddTail((struct List
*)&GetOBase(OOPBase
)->ob_ServerList
89 ReleaseSemaphore( & GetOBase(OOPBase
)->ob_ServerListLock
);
91 ReturnBool ("OOP_AddServer", TRUE
);
94 FreeMem(sn
, sizeof (struct ServerNode
));
97 } /* if (valid parameters) */
99 ReturnBool ("OOP_AddServer", FALSE
);
102 } /* OOP_AddServer */