Exemple #1
0
IoSocket *IoSocket_proto(void *state)
{
	IoObject *self = IoObject_new(state);

	IoObject_tag_(self, IoSocket_newTag(state));
	IoObject_setDataPointer_(self, Socket_new());

	IoState_registerProtoWithFunc_((IoState *)state, self, IoSocket_proto);

	{
		IoMethodTable methodTable[] = {
		{"asyncStreamOpen", IoSocket_asyncStreamOpen},
		{"asyncUdpOpen", IoSocket_asyncUdpOpen},
		{"isOpen", IoSocket_isOpen},
		{"isValid", IoSocket_isValid},
		{"isStream", IoSocket_isStream},

		{"asyncBind", IoSocket_asyncBind},
		{"asyncListen", IoSocket_asyncListen},
		{"asyncAccept", IoSocket_asyncAccept},

		{"asyncConnect", IoSocket_asyncConnect},

		{"asyncStreamRead", IoSocket_asyncStreamRead},
		{"asyncStreamWrite", IoSocket_asyncStreamWrite},

		{"asyncUdpRead", IoSocket_asyncUdpRead},
		{"asyncUdpWrite", IoSocket_asyncUdpWrite},

		{"close", IoSocket_close},
		{"descriptorId", IoSocket_descriptorId},

		{"setSocketReadBufferSize", IoSocket_setSocketReadBufferSize},
		{"setSocketWriteBufferSize", IoSocket_setSocketWriteBufferSize},

		{"getSocketReadLowWaterMark", IoSocket_getSocketReadLowWaterMark},
		{"getSocketWriteLowWaterMark", IoSocket_getSocketWriteLowWaterMark},

		{"setSocketReadLowWaterMark", IoSocket_setSocketReadLowWaterMark},
		{"setSocketWriteLowWaterMark", IoSocket_setSocketWriteLowWaterMark},

		{"setNoDelay", IoSocket_setNoDelay},
		
		{"errorNumber", IoSocket_errorNumber},
		{"errorDescription", IoSocket_errorDescription},

		{NULL, NULL}
		};
		IoObject_addMethodTable_(self, methodTable);
	}

	return self;
}
Exemple #2
0
IoSocket *IoSocket_proto(void *state)
{
	IoObject *self = IoObject_new(state);

	IoObject_tag_(self, IoSocket_newTag(state));
	IoObject_setDataPointer_(self, Socket_new());

	IoState_registerProtoWithFunc_((IoState *)state, self, protoId);

	{
		IoMethodTable methodTable[] = {
		{"asyncStreamOpen", IoSocket_asyncStreamOpen},
		{"asyncUdpOpen", IoSocket_asyncUdpOpen},
		{"isOpen", IoSocket_isOpen},
		{"isValid", IoSocket_isValid},
		{"isStream", IoSocket_isStream},

		{"asyncBind", IoSocket_asyncBind},
		{"asyncListen", IoSocket_asyncListen},
		{"asyncAccept", IoSocket_asyncAccept},

		{"asyncConnect", IoSocket_asyncConnect},

		{"asyncStreamRead", IoSocket_asyncStreamRead},
		{"asyncStreamWrite", IoSocket_asyncStreamWrite},

		{"asyncUdpRead", IoSocket_asyncUdpRead},
		{"asyncUdpWrite", IoSocket_asyncUdpWrite},

		{"close", IoSocket_close},
		{"descriptorId", IoSocket_descriptorId},

		{"setSocketReadBufferSize", IoSocket_setSocketReadBufferSize},
		{"setSocketWriteBufferSize", IoSocket_setSocketWriteBufferSize},

		{"getSocketReadLowWaterMark", IoSocket_getSocketReadLowWaterMark},
		{"getSocketWriteLowWaterMark", IoSocket_getSocketWriteLowWaterMark},

		{"setSocketReadLowWaterMark", IoSocket_setSocketReadLowWaterMark},
		{"setSocketWriteLowWaterMark", IoSocket_setSocketWriteLowWaterMark},

		{"setNoDelay", IoSocket_setNoDelay},
		
		{"errorNumber", IoSocket_errorNumber},
		{"errorDescription", IoSocket_errorDescription},

		{"setAddress", IoSocket_setAddress},
		
		{"fromFd", IoSocket_fromFd},
		
		{NULL, NULL}
		};
		IoObject_addMethodTable_(self, methodTable);
	}

#define CONSTANT(name) IoObject_setSlot_to_(self, IOSYMBOL(#name), IONUMBER(name));

		CONSTANT(AF_INET);
		CONSTANT(AF_UNIX);
		
	return self;
}