Implementing a 9p server - c

I am looking to develop a C implementation of a 9p file server on a Linux machine. There isn't enough documentation in the internet about 9p and I am not very experienced with implementing servers. My general design is as follows:
Use UNIX sockets to listen to incoming 9p messages.
Decode the 9p message and spawn a new thread to perform the required task.
Reply to the client with the appropriate 9p reply message.
The server would just live in the user space and it will translate the 9p messages into a UNIX call.
Do you see any problems or have any recommendations regarding the proposed design? Are there any documentations that you can refer me to that will help me? How do you think I should debug my server and make sure it is working correctly.

Consider libixp (MIT license).
I've played around with wmii and use it in everyday work. libixp was part of wmii (in the earliest releases) and now it is an independent project. Check wmii's early versions to get a good starting point or dive directly into libixp.
To debug your server just mount it with 9PFUSE(4) with parameter −D to print each FUSE and 9P message.

Related

How to create a BACnet client in C

I am trying to create a client in C that will talk with a BACnet server. This BACnet server is stored on an industrial device (CAN2GO) and I am not sure how I could talk with this device.
I spent quite some time reading documentation for BACnet and I never found a clear example for a BACnet client. I already did some server and clients using TCP and UDP but I don't know how to start this BACnet client and I must say I am getting quite desperate.
I found a library which seems to correspond to what I want which is called BACnet protocol stack but when I tried the whois exemple no device was found (I expected to found the bacnet server but maybe I shouldn't ?).
So my question is : could you give me an exemple in C, or another language but C would be better, that would communicate with a BACnet server (nothing complicated just a question and analysing response). This example could be using the library I just wrote about or if you prefer another library I am of course open to everything.
Thank you very much for your time and answers.
I have used that stack and it is the best open source one you are going to find. If you cannot see anything using the demo\whois\bacwi example from that library, then there is something wrong with your setup. In particular, are you using IP? Are your BACnet client and BACnet server on different machines (they cannot be on the same without some serious tweaking)? Are the two machines on the same IP subnet? (They must be, once again, unless you do some serious tweaking (in this case, setting up BBMDs (BACnet Broadcast Management Devices))).
You will also want to try the "Read Property" example (demo\readprop\bacrp.exe) to actually read a value from the server.
If you are still stuck, then post your detailed problem at the link on Sourceforge, Steve, the author, is very responsive to questions.
I am currently using the stack - just started. I had a little trouble at first, not sure if my problem is the same but.. I basically am using some BAC components made from Schneider Electric (UNC-500) and an old un-supported platform (Niagara R2). On my laptop I created a host server and addressed it to a private LAN network between it and the UNC. My laptop was also using wifi, which was utilizing DHCP, so I had two separate interfaces going. This was my problem. I couldn't read or get 'I-AM' responses back from the UNC. As soon as I turned the WIFI off, I got the 'I-AM' broadcasts. Make sure that you are on the same network as your device, and that there are not other interfaces active. Maybe there is a way to assign the interface to use, IDK. I just started using it.

lwIP telnet example?

I'm doing some experiments with lwIP on a small, embedded device. There are some examples that come with lwIP but they do not help me. What I want to implement is a server (using wlIP) that accepts a connection, reads several commands, sends several answers to the connected client and closes only when the connection is interrupted or a special close-command is sent.
So somehow similar to a telnet-server.
Is there an example for lwIP available that demonstrates this behaviour?
Thanks!
I know this is an old question - but I found it when looking for something similar!
If you look in the lwip contrib directory (http://download.savannah.gnu.org/releases/lwip/) there are some example applications - including a tcp (and udp) echo server.
You don't say what device you are using or whether or not you are using an RTOS, so it is hard to provide example code. However, if you are not using an RTOS I would highly recommend you start! My experience of using the lwip raw api (without an rtos) is that it is difficult to read data from the outside world (e.g. using interrupts) without things falling over.
HTH,
Alex

HTML5 Web socket Handshaking

I'm sort of new to web programming, but I wanted to write a HTML interface for a embedded device (coded in C) that I am developing. I've already implemented a stream server (a la beej's socket server example) and a java client, but I'm interested in implementing a HTML5 Socket interface instead.
I am having some trouble with the handshaking (in so much as the server accepts the connection but the web page does not), and was wondering if there was a specification available somewhere on line. The w3c spec seems to only describe the API (as far as I can tell) and not the details of the handshake. I'm not looking for a fully written example (I can do that!) just a reference for the handshaking that is better than the Wikipedia entry (or an explanation of why that entry should be enough to fully understand the spec).
If anyone could help me get it up and running I will happily package it all in a library and demo and put it up on google code.
Thanks... and please let me know if you need more info to help answer the quesiton!
It looks like this is the specifiction here. I'm not much of a web prgrammer myself either. However, based on my limited understanding, I'm curious about whether you really need to implement WebSockets. Could you just using a series of HTTP messages instead?
Did you check your code against existing servers :
http://www.codeproject.com/KB/webservices/c_sharp_web_socket_server.aspx?msg=3364691 ?
with updated to last websocket specification here :
http://nugget.codeplex.com/
Another one here :
or http://superwebsocket.codeplex.com/
Not much difference betwee c# eand C in this case...

What is the format for the headers and message body of a TIBCO-RV packet?

I need to decode a packet sent using TIBCO-RV and pull fields out of the header and skip over the message body. I have not been able to any examples or documentation. Does anybody know of any open source applications that might do this or if there is a Wireshark dissector out there somewhere?
Maybe you should try applying for a license and getting the official documentation. According to Wikipedia:
TIBCO provides messaging APIs in C,
C++, Java, Visual BASIC , Perl and
.NET to receive data feeds on MS Excel
spreadsheets and other applications of
choice.
Failing that, you could perhaps dive into the TIBCO:RV Perl module.
The methods which TibcoRV implements reliable mutli-cast are propriety, but one would assume easy to reverse engineer. I don't believe any of the official documentation goes into detail on the packet level detail. It's quite easy to get the data out if you have the API.
Several things come to mind:
Is the client on your machine running? This is required in order to create the multicast subscription (unless you are using broadcast mode). Otherwise, you need to have some client subscribe to the multicast channel, or your switch shouldn't forward the traffic.
Generally, you will have a single rrd running locally. You have TCP traffic between the RRD and your app. You can use an app like socketsniff to view the traffic between the two.

DCHP with database backend

Here my first question :P.
I am developing some little projectes. I want to change dhcp server rules of IP/MAC without rebooting the server (In a dinamic infrastructure).
I think that the best solution is to use a dhcp server with a database backend, in order to change the SQL information (With an easy JDBC client).
But I want to know some suggestion about open Source Projects, or howto's that explain how to implement it.
Thank you very much
Usually on Unix, long running daemons listen for the HUP signal. On receiving that signal, they re-read their configuration files. This allows daemons to have no down time, but get updated configuration options.
The guys at ISC (authors of BIND and the ISC DHCP server) are working on KEA, a new DHCP server implementation that -- among other nice features -- has SQL support. The source code has had support for SQLite and MySQL for years, and PostgreSQL support was added recently.
There's no proper release yet, and very little activity on their dev/users mailing lists. Hopefully that will change as the code matures, releases are made, distros start packaging it, and it gains traction with users.
SpliFF
On Unix.
No, restart the DHCP server, no the machine :). Sorry.
Because when you change the dhcp.conf you need to restart the dhcp (dhcpd)

Resources