Browse Source

Various function signature fixes

1.0.0
Georg Hopp 10 years ago
parent
commit
1faa9b61ec
  1. 2
      include/tr/comm_manager.h
  2. 5
      include/tr/interface/protocol.h
  3. 7
      src/comm_manager.c
  4. 36
      src/comm_manager_epoll.c
  5. 32
      src/comm_manager_poll.c
  6. 3
      src/comm_manager_shutdown.c
  7. 3
      src/comm_manager_shutdown_read.c
  8. 3
      src/comm_manager_shutdown_write.c
  9. 2
      src/datagram_service.c
  10. 17
      src/i_protocol.c
  11. 8
      src/protocol_raw.c

2
include/tr/comm_manager.h

@ -46,7 +46,7 @@ TR_CLASSVARS_DECL(TR_CommManager) {
TR_CV_EXTENDS(TR_EventHandler);
};
TR_EventDone TR_commManagerShutdown(TR_CommManager, TR_Event event);
TR_EventDone TR_commManagerShutdown(void *, TR_Event event);
#endif // __TR_COMM_MANAGER_H__

5
include/tr/interface/protocol.h

@ -31,7 +31,7 @@
#include "tr/protocol.h"
#include "tr/proto_message.h"
typedef TR_ProtoMessage (* fptr_TR_protoCreateMessage)(void *);
typedef TR_ProtoMessage (* fptr_TR_protoCreateMessage)(void *, va_list *);
typedef TR_ProtoMessage (* fptr_TR_protoCreateRequest)(void *, va_list *);
typedef TR_ProtoMessage (* fptr_TR_protoCreateResponse)(void *, va_list *);
typedef TR_RemoteData (* fptr_TR_protoCompose)(void *, TR_ProtoMessage);
@ -47,7 +47,8 @@ TR_INTERFACE(TR_Protocol) {
fptr_TR_protoCompose compose;
};
TR_ProtoMessage TR_protoCreateMessage(void *, TR_Socket);
TR_ProtoMessage TR_vprotoCreateMessage(void *, TR_Socket, va_list*);
TR_ProtoMessage TR_protoCreateMessage(void *, TR_Socket, ...);
TR_ProtoMessage TR_vprotoCreateRequest(void *, TR_Socket, va_list*);
TR_ProtoMessage TR_protoCreateRequest(void *, TR_Socket, ...);
TR_ProtoMessage TR_vprotoCreateResponse(void *, TR_Socket, va_list*);

7
src/comm_manager.c

@ -83,8 +83,9 @@ TR_commManagerEnableWrite(void * _this, TR_Event event)
static
TR_EventDone
TR_commManagerAddEndpointEvt(TR_CommManager this, TR_Event event)
TR_commManagerAddEndpointEvt(void * _this, TR_Event event)
{
TR_CommManager this = _this;
TR_commManagerAddEndpoint(this, (TR_CommEndPoint)event->subject);
return TR_EVENT_DONE;
@ -96,8 +97,8 @@ TR_EventDone TR_commManagerPollRead(void *, TR_Event);
TR_EventDone TR_commManagerDisableRead(void *, TR_Event);
TR_EventDone TR_commManagerDisableWrite(void *, TR_Event);
TR_EventDone TR_commManagerClose(void *, TR_Event);
TR_EventDone TR_commManagerShutdownRead(TR_CommManager, TR_Event);
TR_EventDone TR_commManagerShutdownWrite(TR_CommManager, TR_Event);
TR_EventDone TR_commManagerShutdownRead(void *, TR_Event);
TR_EventDone TR_commManagerShutdownWrite(void *, TR_Event);
static
void

36
src/comm_manager_epoll.c

@ -66,7 +66,7 @@ commManagerEpollDtor(void * _this)
}
static
void
TR_EventDone
TR_commManagerEpollAddEndpoint(void * _this, TR_CommEndPoint endpoint)
{
TR_CommManagerEpoll this = _this;
@ -79,10 +79,12 @@ TR_commManagerEpollAddEndpoint(void * _this, TR_CommEndPoint endpoint)
event.events = this->events[handle];
epoll_ctl(this->handle, EPOLL_CTL_ADD, handle, &event);
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollSelect(void * _this, TR_Event event, unsigned long timeout)
{
TR_CommManagerEpoll this = _this;
@ -131,11 +133,13 @@ TR_commManagerEpollSelect(void * _this, TR_Event event, unsigned long timeout)
NULL));
}
}
return TR_EVENT_DONE;
}
static
inline
void
TR_EventDone
TR_commManagerEpollDisable(void * _this, uint32_t mask, TR_Event event)
{
TR_CommManagerEpoll this = _this;
@ -148,11 +152,13 @@ TR_commManagerEpollDisable(void * _this, uint32_t mask, TR_Event event)
_event.events = this->events[handle];
epoll_ctl(this->handle, EPOLL_CTL_MOD, handle, &_event);
return TR_EVENT_DONE;
}
static
inline
void
TR_EventDone
TR_commManagerEpollEnable(void * _this, uint32_t mask, TR_Event event)
{
TR_CommManagerEpoll this = _this;
@ -165,48 +171,60 @@ TR_commManagerEpollEnable(void * _this, uint32_t mask, TR_Event event)
_event.events = this->events[handle];
epoll_ctl(this->handle, EPOLL_CTL_MOD, handle, &_event);
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollEnableWrite(void * _this, TR_Event event)
{
if (! TR_socketFinWr(((TR_CommEndPoint)event->subject)->transport)) {
TR_commManagerEpollEnable(_this, EPOLLOUT, event);
}
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollEnableRead(void * _this, TR_Event event)
{
if (! TR_socketFinRd(((TR_CommEndPoint)event->subject)->transport)) {
TR_commManagerEpollEnable(_this, EPOLLIN, event);
}
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollDisableWrite(void * _this, TR_Event event)
{
TR_commManagerEpollDisable(_this, EPOLLOUT, event);
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollDisableRead(void * _this, TR_Event event)
{
TR_commManagerEpollDisable(_this, EPOLLIN, event);
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerEpollClose(void * _this, TR_Event event)
{
TR_CommManagerEpoll this = _this;
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
epoll_ctl(this->handle, EPOLL_CTL_DEL, endpoint->transport->handle, NULL);
return TR_EVENT_DONE;
}
static

32
src/comm_manager_poll.c

@ -65,17 +65,19 @@ commManagerPollDtor(void * _this)
}
static
void
TR_EventDone
TR_commManagerPollAddEndpoint(void * _this, TR_CommEndPoint endpoint)
{
TR_CommManagerPoll this = _this;
this->fds[endpoint->transport->handle].fd = endpoint->transport->handle;
this->fds[endpoint->transport->handle].fd = endpoint->transport->handle;
this->fds[endpoint->transport->handle].events = 0;
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollSelect(void * _this, TR_Event event, unsigned long timeout)
{
TR_CommManagerPoll this = _this;
@ -126,10 +128,12 @@ TR_commManagerPollSelect(void * _this, TR_Event event, unsigned long timeout)
}
}
}
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollEnableWrite(void * _this, TR_Event event)
{
TR_CommManagerPoll this = _this;
@ -138,10 +142,12 @@ TR_commManagerPollEnableWrite(void * _this, TR_Event event)
if (! TR_socketFinWr(endpoint->transport)) {
this->fds[endpoint->transport->handle].events |= POLLOUT|POLLHUP;
}
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollEnableRead(void * _this, TR_Event event)
{
TR_CommManagerPoll this = _this;
@ -150,30 +156,36 @@ TR_commManagerPollEnableRead(void * _this, TR_Event event)
if (! TR_socketFinRd(endpoint->transport)) {
this->fds[endpoint->transport->handle].events |= POLLIN;
}
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollDisableWrite(void * _this, TR_Event event)
{
TR_CommManagerPoll this = _this;
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
this->fds[endpoint->transport->handle].events &= ~(POLLOUT|POLLHUP);
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollDisableRead(void * _this, TR_Event event)
{
TR_CommManagerPoll this = _this;
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
this->fds[endpoint->transport->handle].events &= ~POLLIN;
return TR_EVENT_DONE;
}
static
void
TR_EventDone
TR_commManagerPollClose(void * _this, TR_Event event)
{
TR_CommManagerPoll this = _this;
@ -181,6 +193,8 @@ TR_commManagerPollClose(void * _this, TR_Event event)
this->fds[endpoint->transport->handle].events = 0;
this->fds[endpoint->transport->handle].fd = -1;
return TR_EVENT_DONE;
}
static

3
src/comm_manager_shutdown.c

@ -30,8 +30,9 @@
#include "tr/_comm_manager.h"
TR_EventDone
TR_commManagerShutdown(TR_CommManager this, TR_Event event)
TR_commManagerShutdown(void * _this, TR_Event event)
{
TR_CommManager this = _this;
nfds_t i;
for (i=0; i<=this->max_handle; i++) {

3
src/comm_manager_shutdown_read.c

@ -29,8 +29,9 @@
#include "tr/_comm_manager.h"
TR_EventDone
TR_commManagerShutdownRead(TR_CommManager this, TR_Event event)
TR_commManagerShutdownRead(void * _this, TR_Event event)
{
TR_CommManager this = _this;
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
if (! TR_socketFinRd(endpoint->transport)) {

3
src/comm_manager_shutdown_write.c

@ -28,8 +28,9 @@
#include "tr/_comm_manager.h"
TR_EventDone
TR_commManagerShutdownWrite(TR_CommManager this, TR_Event event)
TR_commManagerShutdownWrite(void * _this, TR_Event event)
{
TR_CommManager this = _this;
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
if (! TR_socketFinWr(endpoint->transport)) {

2
src/datagram_service.c

@ -86,7 +86,7 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data)
}
static
int
size_t
datagramServiceCompose(void * _this, TR_ProtoMessage message)
{
TR_RemoteData data =

17
src/i_protocol.c

@ -31,16 +31,27 @@
TR_CREATE_INTERFACE(TR_Protocol, 5);
TR_ProtoMessage
TR_protoCreateMessage(void * _this, TR_Socket remote)
TR_vprotoCreateMessage(void * _this, TR_Socket remote, va_list * params)
{
TR_ProtoMessage callret;
TR_RETCALL(_this, TR_Protocol, createMessage, callret);
TR_RETCALL(_this, TR_Protocol, createMessage, callret, params);
if (callret != NULL) {
callret->remote = remote;
}
return callret;
}
TR_ProtoMessage
TR_protoCreateMessage(void * _this, TR_Socket remote, ...)
{
TR_ProtoMessage callret;
va_list params;
va_start(params, remote);
callret = TR_vprotoCreateMessage(_this, remote, &params);
va_end(params);
return callret;
}
TR_ProtoMessage
TR_vprotoCreateRequest(void * _this, TR_Socket remote, va_list * params)
{
@ -67,7 +78,7 @@ TR_ProtoMessage
TR_vprotoCreateResponse(void * _this, TR_Socket remote, va_list * params)
{
TR_ProtoMessage callret;
TR_RETCALL(_this, TR_Protocol, createResponse, callret, &params);
TR_RETCALL(_this, TR_Protocol, createResponse, callret, params);
if (callret != NULL) {
callret->remote = remote;
}

8
src/protocol_raw.c

@ -45,9 +45,9 @@ static void protocolRawDtor(void * _this) {}
static
TR_ProtoMessage
protocolRawCreateMessage(void * _this, TR_Socket remote)
protocolRawCreateMessage(void * _this, va_list * args)
{
return (TR_ProtoMessage)TR_new(TR_ProtoMessageRaw, remote);
return (TR_ProtoMessage)TR_new(TR_ProtoMessageRaw);
}
static
@ -110,9 +110,9 @@ protocolRawCompose(void * _this, TR_ProtoMessage _message)
{
TR_ProtoMessageRaw message = (TR_ProtoMessageRaw)_message;
TR_SizedData data;
data = (TR_SizedData)TR_new(TR_RemoteData, NULL, 0, _message->remote);
data->size = message->size + 2;
data->data = TR_malloc(data->size);
*(uint16_t *)data->data = htons(message->size);

Loading…
Cancel
Save