Re: Is enet DLPI compatible ??
Re: Is enet DLPI compatible ??
- Subject: Re: Is enet DLPI compatible ??
- From: Rich Kubota <email@hidden>
- Date: Thu, 15 Aug 2002 22:46:44 -0700
At 12:54 AM +0530 8/16/02, Suhail Kazi wrote:
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 ?
The enet0 driver is dlpi compatible under Mac OS 9.
When I send a DL_ATTACH_REQ, am I wrong in expecting a DL_OK_ACK ?
You are correct, you should receive the DL_OK_ACK when you make the
OTStreamGetMessage following the OTStreamPutMessage (which is where
the DL_ATTACH_REQ is passed to the driver.
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",...)
In looking at the code below, the first thing is that you are mixing
the OT methods for accessing the ethernet driver. You start by using
the OT endpoint API's, to open a connection with the ethernet driver
(method 1 as you list it), then follow with the streams API calls to
perform the attach and bind functions (method 3 by your list)
I can provide a sample using strictly the OT Endpoint API's to
demonstrate how to communicate with the Ethernet driver. As for
using the stream's api, I can also provide code to get you started.
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. ?
The OTGet/PutMessage calls were implemented for those accustomed to
STREAMS programming. The message you refer to regards support under
Carbon and OT for Mac OS X. Given the limits to engineering
resources, an upper management decision was made to not not provide
support for the STREAMs API's in favor of using these engineering
resources for other projects like IP v6 for example.
Under a separate message, I will send an LLC sample for you to try out.
rich kubota
*********************************************************
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.
--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
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.