libs/neuronet: Implemented the new function NNet_GetMaster.
[neuro.git] / libs / neuronet / interface.c
blob91ec3d6eab35f748a2f3f8c68b0217240bc2e97e
1 /* interface of the whole module */
3 /*-------------------- Extern Headers Including --------------------*/
4 #include <neuro/NEURO.h>
6 /*-------------------- Local Headers Including ---------------------*/
7 #include <global.h>
8 #include "common.h"
10 #include "slave.h"
11 #include "master.h"
12 #include "client.h"
13 #include "server.h"
14 #include "status.h"
16 /*-------------------- Main Module Header --------------------------*/
19 /*-------------------- Other ----------------------------*/
21 /*-------------------- Global Variables ----------------------------*/
23 /*-------------------- Static Variables ----------------------------*/
25 /*-------------------- Static Prototypes ---------------------------*/
29 /*-------------------- Static Functions ----------------------------*/
31 /*-------------------- Global Functions ----------------------------*/
33 u32
34 NNet_GetStatus(const Status *sta)
36 return Status_GetStatus(sta);
39 char *
40 NNet_GetPacket(const Status *sta)
42 return Status_GetPacket(sta);
45 int
46 NNet_GetPacketLen(const Status *sta)
48 return Status_GetPacketLen(sta);
51 Slave *
52 NNet_GetSlave(const Status *sta)
54 return Status_GetSlave(sta);
57 Master *
58 NNet_GetMaster(const Status *sta)
60 return Status_GetMaster(sta);
63 void
64 NNet_SetData(Slave *slv, void *ptr)
66 Slave_SetData(slv, ptr);
69 void *
70 NNet_GetData(const Slave *slv)
72 return Slave_GetData(slv);
75 void
76 NNet_SetTimeOut(Slave *slv, t_tick ts)
78 Client_SetTimeOut(slv, ts);
81 void
82 NNet_SetDebugFilter(const char *filter)
84 Neuro_SetDebugFilter(filter);
87 char *
88 NNet_GetIP(Slave *slv)
90 return Client_GetIP(slv);
93 int
94 NNet_Send(Slave *src, const char *message, u32 len)
96 return Client_Send(src, message, len);
99 int
100 NNet_SetSendPacketSize(Master *msr)
102 return Master_SetSendPacketSize(msr);
105 void
106 NNet_SetQuitFlag(Master *msr)
108 Master_SetQuitFlag(msr);
111 void
112 NNet_DisconnectClient(Slave *client)
114 Server_DisconnectClient(client);
117 void
118 NNet_SetResponderCB(Master *msr, void *customData, int (*cb)(void *customData, Status *status))
120 if (msr && cb)
122 msr->callback = cb;
123 msr->customData = customData;
127 Slave *
128 NNet_Listen(Master *msr, const char *listen_ip, int port)
130 return Server_Create(msr, listen_ip, port);
133 Slave *
134 NNet_Connect(Master *msr, const char *host, int port)
136 return Client_Connect(msr, host, port);
139 /*-------------------- Poll ----------------------------------------*/
140 Status *
141 NNet_Poll(Master *msr)
143 return Master_Poll(msr);
146 /*-------------------- Constructor Destructor ----------------------*/
148 Master *
149 NNet_Create(u32 connection_type)
151 return Master_Create(connection_type);
154 void
155 NNet_Destroy(Master *msr)
157 Master_Destroy(msr);