Is enet DLPI compatible ??
Is enet DLPI compatible ??
- Subject: Is enet DLPI compatible ??
- From: "Suhail Kazi" <email@hidden>
- Date: Fri, 16 Aug 2002 00:54:58 +0530
Hi,
I am starting out with OT on Mac 9 and am not a networking expert. I
have included code which checks for DLPI compatibility of "enet" layer,
and I am trying to get that running on 9. Is enet0 DLPI compatible.
Looks so..from all the documentation and code, but wanna be sure about
it. Or rather I should ask which layers on a Mac networking software
are DLPI compatible ?
When I send a DL_ATTACH_REQ, am I wrong in expecting a DL_OK_ACK ? The
OT[Get/Put]Message() calls work fine. Irrespective of whatever primitive
I Put, I always receive a DL_INFO_REQ(value 0) back in return. Can
someone point me out what is wrong in the code below ?? I have gone
through some chapters of "Inside Mac:Netwking with OT" and
"OTAdvancedClientProgramming"(OT-ACP) book. At one point (Ref:
OTACP-Ch3 - RawStreams) mentions three ways to open/create a Stream
1. OTOpenEndpoint(OTCreateConfiguration("tcp")....).
2. OTCreateStream(OTCreateConfiguration("tcp")....)
3. OTStreamOpen("/dev/tcp",...)
I am using the first method in my code. Is it right ? I am confused
about the difference between the 3 methods ? Also OTGetMessage and
OTPutMessage documentation says Apple is not going to support these APIs
as they dont find any developer need for these. Why is it so ? Is there
any alternate set of APIs for the same functionality. ?
*********************************************************
Here is the sample code I am trying to run on Mac 9.
*********************************************************
EndPointRef myEP; //global
main(int argc,char *argv[])
{
OSStatus err = 0;
err = InitOpenTransport();
if(noErr == err)
{
myEP = OTOpenEndpoint(OTCreateConfiguration("enet"), 0, NULL, &err);
if(!err)
{
if(OTIsSynchronous(myEP))
{
printf("My Endpoint is synchronous\n");
if(!OTSetAsynchronous(myEP)) / So that
OTGet/PutMessage work. */
printf("myEndpoint now asynchronous.\n");
else
{
printf("Cannot set myEP asynchronous, hence
[Get/Put]Message wont work..so Bail out\n");
return -1;
}
}
else
printf("My Endpoint is Asynchronous ..Proceed.");
dlattach();
/* Following two functions currently unused. Also is it
true, that if ATTACH_REQ fails in dlattach(), then even PutMessage for
BIND_REQ
will fail if I have it in dlbind(). */
/*dlbind() ....My function..Not showing it here for brevity. */
}
else
{
printf("Could not create tcp endpoint. Bail out !!!!");
return -1;
}
}
/ *** End of main ***/
/*** Start of dlattach ***/
dlattach()
{
struct strbuf ctlbuf;
dl_attach_req_t att_req;
dl_error_ack_t *error_ack;
union DL_primitives dl_prim;
OTFlags flags = 0;
OSStatus lerr=0;
att_req.dl_primitive = DL_ATTACH_REQ;
att_req.dl_ppa = 0;
ctlbuf.len = sizeof(dl_attach_req_t);
ctlbuf.buf = (char *) &att_req;
lerr = OTPutMessage(myEP, &ctlbuf, NULL, 0);
if (noErr != lerr)
{
printf("dlattach: putmsg fail..\n");
return -1;
}
ctlbuf.maxlen = sizeof(union DL_primitives);
ctlbuf.len = 0;
ctlbuf.buf = (char *) &dl_prim;
lerr = OTGetMessage(myEP, &ctlbuf, NULL, &flags);
if ( noErr != lerr) {
printf("dlattach: getmsg fail..\n");
return -1;
}
switch (dl_prim.dl_primitive)
{
case DL_INFO_ACK:
printf("Received INFO_ACK\n");
break;
case DL_OK_ACK:
printf("Received DL_OK_ACK\n");
break;
case DL_ERROR_ACK:
printf("Received DL_ERROR_ACK\n");
break;
default:
printf("dlattach: protocol error 3\n");
break;
}
} // end of dlbind.
************************************************************
Code Ends
************************************************************
As you can find out, I have lots of questions. Can someone please let me
know what is wrong, or at least guide me towards the proper direction.
Any help is welcome.
Thanks in advance,
Suhail.
**************************Disclaimer************************************
Information contained in this E-MAIL being proprietary to Wipro Limited is
'privileged' and 'confidential' and intended for use only by the individual
or entity to which it is addressed. You are notified that any use, copying
or dissemination of the information contained in the E-MAIL in any manner
whatsoever is strictly prohibited.
***************************************************************************
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.