Anant Narayanan anant@kix.in http://www.kix.in/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Alternate 9P Implementations PHP and JavaScript A Summer of Code Proposal Prepared for Plan9 from Bell Labs March 20th, 2007 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ WHY? ~~~~ 9P would benefit from a PHP [1] implementation since it is, after all, a network file system; and PHP is one of the most popular languages for the Internet. In addition, a JavaScript [2] client for the 9P protocol will be developed that will allow users to use the web browser to access a remote 9P file system. Both of these tasks would enable 9P to enter the Web 2.0 [3] scenario, by enabling users to expose their 9P based file-systems to the Internet in a secure and robust mechanism that has proven itself over the years. Applications for this could range from simple web-browser-based clients for a 9P filesystem, to massive collaborative "web-spaces" running on a single 9P filesystem. ~~~~ HOW? ~~~~ PHP has a mature extension mechanism, through which external functions can be introduced in PHP user-space. The project will develop such an extension that binds the native C-based 9P library and introduces that API to PHP programmers. This will be done for version 5 of PHP, and I will try to get this extension included in the main PHP distribution. A reference client for the 9P system will also be developed to ensure that the server does indeed work correctly. The client will work against a sample server (written using the new PHP extension, of course - maybe for a RAMFS system?) which will also be developed as a part of the project. Once this is done, a client written in JavaScript will be developed. This would entail writing JS functions that are equivalents of their corresponding 9P calls, but use HTTP as a transport. Of course, a "listener" script on the server side is also required to act as a mediator between the "real" 9P server and the JS client. The job of this mediator script would be simply to pass on the data sent by the JS client to the local 9P server and vice-versa. An example implementation of such a mediator script will also be written. To summarize, here's what I'll be doing: * Wrap the native C implementation of 9P in PHP5. This involves developing a PHP5 extension that provides PHP functions equivalent to their C counterparts. * Wrap the native C implementation of 9P in JavaScript. This involves developing a JS API corresponding to the 9P API, and implementing them to work across an HTTP transports such that the 9P calls are sent to a server, where they will be executed. ~~~~~~ BONUS! ~~~~~~ As an added feature, I will also be developing a REST [4] style web service for the 9P API. This web service will be implemented using the PHP extension just developed. This would allow web developers not familiar with the 9P protocol to develop web applications that access 9P resources. Ultimately, a very AJAXish, modern, web based clients to any 9P system can be made. Whenever a user needs to "share" a 9P based filesystem, all he/she would have to do is to initialize the web service on it, and tell his/her friends to use the JavaScript client to access it. ~~~~~ When? ~~~~~ The project will be spaced out roughly as follows: * Apr 09 - May 01 : Get friendly with the mentors and the Plan9 Community * May 01 - May 28 : Familiarize self with the 9P "specification" Phase I * May 28 - Jun 20 : Begin! Write PHP binding for the 9P system * Jun 20 - Jun 30 : Write sample client and server in PHP, Test Phase II * Jun 30 - Jul 20 : Write JS client o access remote 9P server resources * Jul 20 - Jul 30 : Write listener script to receive 9P calls from JS Client Phase III * Jul 30 - Aug 20 : Bonus time! Fix bugs, write random code, make mentor happy! Phase IV * Party and show off Glenda T-Shirt ~~~~~~~ Why Me? ~~~~~~~ I am an undergraduate student at the Malaviya National Institute of Technology, Jaipur, India; pursuing my Bachelor of Technology in Computer Engineering. I have been involved in the FOSS community for almost 3 years now. I am an active developer and documentation contributor in several open source projects [5], the most prominent of them being Gentoo Linux, GNU Parted and PHP-GTK. I became a Gentoo Developer as a result of my participation in last year's Summer of Code; during which I developed a web-based GuideXML editor: "Beacon" for the Gentoo Foundation. "Beacon" [6] includes a REST style web service (for XML validation) and was developed entirely in PHP and JavaScript. In addition, my work with PHP-GTK (PHP bindings for the Gtk+ GUI toolkit) has given me an intimate understanding of how extensions to PHP are built. I have also delivered several tutorials and written articles on developing REST based web services in PHP [7] and developing web applications in JavaScript [8]. All in All, I am quite confident that I am absolutely the right fit for the tasks described in this proposal! I had applied to six organizations last year, of which four selected me - the highest number of selections for a student in that year. Although I could officially perform only one of those projects, I am continuing work on the other three outside of the SoC. FOSS is something that is already very dear to me, and I can assure you that I will take full responsibility for the maintenance of the software that results from this project even after the Summer of Code concludes. I take every Summer of Code as an opportunity to "infiltrate" and become part of another new community. Since I am already well-versed in the community dynamics of open source projects, I will have absolutely no trouble in mingling with the Plan9 community and working with the infrastructure (Mailing Lists; Version Control Systems - I've extensively worked with CVS, SVN and Git; IRC etc.) already in place. In other words, I can get started almost immediately, giving me an effective coding time of almost 4 months, as opposed to the allotted 3. I sincerely hope that my work during the Summer of Code with 9P will eventually lead me to become a full-time Plan9 developer - something that I've always dreamed of - Plan9 is certainly one of the coolest FOSS projects I have come across so far! You can find out more about me and what I do at my personal home page, and you also might want to look at my formal resume [9]. Please don't hesitate to get back to me if any part of this proposal is not clear to you. Thanks for considering this proposal and for your time! ~~~~~~~~~~ REFERENCES ~~~~~~~~~~ [1] http://www.php.net/ [2] http://en.wikipedia.org/wiki/JavaScript [3] http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html [4] http://en.wikipedia.org/wiki/Representational_State_Transfer [5] http://code.kix.in/ [6] http://code.kix.in/projects/beacon/ [7] http://www.php-mag.net/magphpde/magphpde_issue/psecom,id,21,nodeid,20.html [8] http://www.kix.in/talks.php [9] http://www.kix.in/personal/resume.pdf The latest version of this proposal is available at: http://www.kix.in/soc/07/phpjs9p-plan9.pdf (or) http://www.kix.in/soc/07/phpjs9p-plan9.txt