Hi,<br><br>just for feedback.<br><br>I choose to create the fifo kernel module to accomplish the task since I found more suitable to my needs. If someone wants to check this kernel module, it is available at <a href="http://dgvchannel.cvs.sourceforge.net/dgvchannel/unstable/fifodev/">
http://dgvchannel.cvs.sourceforge.net/dgvchannel/unstable/fifodev/</a>.<br><br>I'm testing it now and probably needs improvements but I think it is very stable and solve the intermixing problem.<br><br>Thanks for all
<br><br><br>Paulo Garcia<br><br><br><br><br><div><span class="gmail_quote">On 2/8/07, <b class="gmail_sendername">Christian</b> <<a href="mailto:crich-ml@beronet.com">crich-ml@beronet.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
yeah my approach works only if you can modify the "write" as well.<br><br>the only way i know which would definitely work is: you need to write a<br>kernel module which creates a char device, there each write results in a
<br>single "copy_from_user" and you won't have intermixing of packets. then<br>you could send the packet either directly to your hardware or you use<br>another character device to send it up to your process which will also
<br>send the exact amount of data, like:<br><br>/dev/packetloopIN + /dev/packetloopOUT<br><br><br>but that's probably as much work as interpreting the q.921 header ;-)<br><br><br><br><br><br><br>Paulo Garcia wrote:<br>
> Hi Christian,<br>><br>> I think I understand what you are saying but the data read comes<br>> directly from libpri and I cannot realize how can I put some data<br>> before the package, because I saw that into libpri there are two
<br>> writes to my socket file descriptor but in the read part (inside my<br>> program thread) there are only one read with both packets togheter.<br>><br>> After I receive the packet from libpri, I can send it directly to my
<br>> card and the packet arrives at other side perfectly since my hardware<br>> already prepared to do it. The only problem is when I get two packets<br>> joint togheter.<br>><br>> I´m thinking if using another kind of interprocess communication I can
<br>> avoid this socketpair behaviour.<br>><br>> Thanks in advance!<br>><br>><br>> Paulo<br>><br>><br>><br>><br>> On 2/7/07, * Christian* <<a href="mailto:crich-ml@beronet.com">crich-ml@beronet.com
</a><br>> <mailto:<a href="mailto:crich-ml@beronet.com">crich-ml@beronet.com</a>>> wrote:<br>><br>> Hi Paulo,<br>><br>> i have had similar issues with a quite different use-case ;-) the<br>
> problem is that you need to frame your messages and transmit these<br>> frames instead of the transparent data. you can use hdlc for<br>> example, i<br>> believe there are some simple implementations out there, but that is
<br>> sort of overkill. The most simple thing would be to just put the<br>> length<br>> of the frame before each packet, the length could be of maximum 4<br>> bytes,<br>> then do a read of just as much bytes which you know from this
<br>> length, like:<br>><br>> uint32 len;<br>> char buf[1024];<br>> read(fd, &len, 4);<br>> read(fd,buf,len);<br>><br>> then you can be sure that you've got only this single frame in buf,
<br>> (well if read returns less then len you need to reread of course).<br>><br>> Besides that i have somewhere read that you can set a HDLC<br>> Property via<br>> fcntl to terminals, but i haven't had ever the time to test that out.
<br>><br>><br>> cheers,<br>><br>> christian<br>><br>><br>> Paulo Garcia wrote:<br>> > Hi,<br>> ><br>> > in my own channel, I'm implementing ISDN support using Libpri. The
<br>> > implementation is completely independent from zaptel then I'm<br>> trying<br>> > to do all communications between my hardware and libpri using<br>> > socketpair function.<br>
> ><br>> > The idea is to create a socketpair, passing fd[0] to pri_new<br>> function<br>> > and writing to fd[1] to pass data to libpri. So far so good...<br>> ><br>> > To receive data from libpri, I have a thread checking for all file
<br>> > descriptors fd[1] using select() function and when I receive<br>> > something, I pass it to my card. This approach also works well but<br>> > sometimes I receive two messages (from libpri) in only one read()
<br>> > call. I think this is because of libpri writes two messages so fast<br>> > then when the read is called, there are already two messages in<br>> socket<br>> > buffer...<br>> >
<br>> > How can I avoid this behavior? Maybe using another way different of<br>> > socketpair ? This communication will be used only inside the same<br>> > process, between different threads.
<br>> ><br>> > Any path or idea will be appreciated.<br>> ><br>> ><br>> > Regards<br>> ><br>> ><br>> > Paulo Garcia<br>> ><br>> ------------------------------------------------------------------------
<br>> ><br>> > _______________________________________________<br>> > --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a><br>> <<a href="http://Easynews.com">
http://Easynews.com</a>> --<br>> ><br>> > asterisk-dev mailing list<br>> > To UNSUBSCRIBE or update options visit:<br>> > <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">
http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>> ><br>><br>> _______________________________________________<br>> --Bandwidth and Colocation provided by <a href="http://Easynews.com">
Easynews.com</a><br>> <<a href="http://Easynews.com">http://Easynews.com</a>> --<br>><br>> asterisk-dev mailing list<br>> To UNSUBSCRIBE or update options visit:<br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">
http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>><br>><br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________<br>
> --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br>><br>> asterisk-dev mailing list<br>> To UNSUBSCRIBE or update options visit:<br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">
http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>><br><br>_______________________________________________<br>--Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br><br>asterisk-dev mailing list
<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br>