02 20 2005, Sunday
It's been a while. For the last week I haven't been as active as normal doing tech stuff, but I made up for it today (Sunday, as I'm writing).
Umm, let's see... to catch up:
Still no luck getting the iPod to work. I ran into difficulties installing Window$ Service Packs and once I finally figured out how to resolve my problem (with my brother's help) and get SP1 installed (because I was offline and no longer had SP2 downloaded), Windows refuses to boot. It gets to the "Windows was not properly shut down" screen where I can choose Safe Mode, Last Known Good, etc and none work -- all cause an immediate reboot. There's a BSOD for a fraction of a second, not long enough to read. I'm actually not too concerned about this, since I'm sure I can get things working again with a boot disk. I haven't even looked for one yet because I've been so busy with linux stuff.
On to that -- I had to fight tooth and nail to get get a new version of glib installed on onyx. I had 1.2.10 and 2.2.2 installed, and gtkpod (linux ipod software; supposedly works with the Shuffle) required gtk+ 2.4 or better. Well, gtk+ required glib 2.4 and pango and atk, but glib had to be installed before pango and atk.... etc. It was a big mess of software, and none of it installed right on first attempt. The problem was that the default install location when building glib from source is /usr/local, but my original Slackware installation came with glib installed to /usr. So even though glib installed just fine, gtkpod and the other programs kept giving errors that my glib was out of date, because they were finding the original glib in /usr. I tried to change where pkg-config looked for glib which fooled most of the ./configures but wouldn't actually work. I also tried to screw with my /etc/ld.so.conf, my $LD_LIBRARY_PATH, etc. Nothing worked, and I couldn't at first figure out why. Finally I randomly realized what was happening, 'make uninstall'ed and 'make clean'ed all the attempted installs and tried again with ./configure --prefix=/usr and it all worked.
...to no avail with gtkpod. Oh, it configured, made, and installed, but because the iPod isn't formatted yet gtkpod doesn't know where to put/how to store songs on it so I can play them. At least the program can see the Shuffle and move files to it. I'm optimistic that once I (FINALLY!) format it, I'll be able to use the iPod Shuffle with linux.
I thought that once I gave up on the iPod for a while I'd be done fscking with glib. This wasn't the case. In a bit of downtime this morning while I was waiting on ethereal to recompile (more on that later), I hacked the xmms source to add a function I've always wanted. Back in the day when Napster was young and desirable (not like now...), I used WinAmp for all my mp3 playing needs. WinAmp had a feature where you could press "Ctrl + V" which would stop playback at the end of the current track. I used to use it all the time (eg) as I was leaving my apartment so I wouldn't have to kill it midsong but I wouldn't have to leave it playing the whole time I was gone or modify my playlist manually. But xmms didn't (before now) have that capability.
Ctrl + V is already bound in xmms, to Visualizations. But Shift + V isn't -- in the source it's commented out but it's supposed to be a 'stop with fade' function. I spent half an hour or so in the source (input.c, input.h, main.c, playlist.c, and plugin.h) and added the "stopnext" capability. I modeled it mostly on the input_pause() function and variables. I had to add a variable to InputPluginData which I wanted to avoid, but it's the Best Way of doing what I want to do. I suppose I could use a thread and sleep for the rest of the current track or wait for the next track to play(), but I don't know how to code that really at all. So this should work.
I went to compile it and got a fscking glib error, saying it needs glib 1.2.2 or newer. I have 1.2.10 and 2.4.8, but in all my hacking around I hosed or buried my glib 1.2.10. I've been too busy with IAX and ethereal all day to try to sort it out. Perhaps tomorrow...
Besides my half-hour jaunt into xmms-land (which was interesting -- all the "real" C I've read has been Mark Spencer's, and this wasn't. I definitely noticed differences in coding styles.), today was an IAX day. I re-configured all 3 of my machines (sigma, onyx, wrt) to each have 2 unique IAX friends -- the other 2 machines. Before I had the same iax username:password for all 3 machines, and that just wasn't working. I couldn't tell who was doing what easily. So now onyx registers to sigma as onyx-sigma:ospass and to wrt as onyx-wrt:owpass, sigma registers to onyx as sigma-onyx:sopass and to wrt as sigma-wrt:swpass, and wrt registers as wrt-onyx:wopass and wrt-sigma:wspass. This makes my life far easier.
I have some funniness going on with the wrt. It doesn't register or allow registrations from either sigma or onyx. Not sure what that's about, as other traffic (web, ssh, icmp) works fine. I looked at the openwrt documentation I have cached on onyx and finally figured out how to permanently configure the essid (I was embarrassed to ever be running an access point with an essid of "linksys"). So now it's one everyone at school would recognize. : ) I think the registration difficulties may result from the preconfigured firewall on the wrt, which I haven't yet analyzed. I'll get there.
I now feel I've got a pretty good handle on the basics of IAX implementation. I looked at several ethereal dumps of IAX calls and noticed right away that the ethereal dissectors are quite out of date. After all, they are almost 6 months old -- that's an eternity in asterisk-land. : ) They're actually so out of date that ethereal-0.10.8 segfaults on me whenever I try to look at an IAX2 packet of type NEW. None of the other packets I looked at caused segfaults, but not all of them were right. About 25 Information Elements (IEs) are new since July 2004, when the dissector was written. And several of them are now basic to any IAX call. I first noticed that ethereal was misreporting the IE for the HANGUP packet, saying it was unknown when it should have specified what the CAUSECODE was. The old method of reporting the hangup cause was as a string in IE_CAUSE; nowadays there's a lookup list in include/asterisk/causes.h and IE_CAUSECODE is used. So I hacked ethereal's dissector (packet-iax2.c and .h) to include the causes list in the header and to handle it appropriately in the code. I was pretty excited when it worked on my first attempt -- again, this was working in non-markster code and it was harder for me to parse.
Later on I went back through and added code for all the "new" information elements. There are several of them that I have never seen in use and I didn't know what possible values would be for the ones of type string, so the updated dissector isn't as fleshed out as it could be. But it at least reports all the IEs I see properly. I'm going to look online when next I can to see if there's a newer version of ethereal, and if it includes a newer iax2 dissector. If it doesn't, perhaps I'll submit what I have for inclusion in the next release.
I'll definitely submit it if I can fix the segfault when parsing NEW packets. I used gdb for the first time tonight to try to debug ethereal to locate the segfault. I found it at once after I figured out how to invoke and run gdb. I'm impressed by this program -- I wish I would have started using it sooner.
I fired up ethereal in -X (hex + ascii) mode and literally hand parsed a few NEW packets to see in practice instead of in code what IEs they contain. That was a worthwhile and educational exercise. In just the half hour or so I was doing that I got to the point where I no longer had to reference notes or configs to read exactly what each packet said. I never thought I'd actually be able to "read" packets so quickly.
I had decided last night that the best use of my time in learning IAX right now would be to shift from just reading code to watching calls on the wire (or air, as the case may be) and diagramming each step of call setup, registration, etc. I got an email from BC this morning saying that he wanted someone to help him create IAX call flow diagrams -- exactly what I had started working on 12 hours previously. So I spent a few hours today making a thorough and pretty (for ASCII...) CFD for an IAX setup. It's not quite as generic as I'd like it to be because I include the specific authentication packets I use, which aren't the only possible ones. But that's easily changed, when I get around to it. I also made a complete iax registration CFD. Both will hopefully be online soon.
***Later...
I got ethereal to parse and display NEW packets without segfaulting, merely by commenting some AST_DATAFORMAT stuff in packet-iax2.c. There's no such thing as AST_DATAFORMAT anymore so I don't think I'm breaking anything by doing this.
Umm, let's see... to catch up:
Still no luck getting the iPod to work. I ran into difficulties installing Window$ Service Packs and once I finally figured out how to resolve my problem (with my brother's help) and get SP1 installed (because I was offline and no longer had SP2 downloaded), Windows refuses to boot. It gets to the "Windows was not properly shut down" screen where I can choose Safe Mode, Last Known Good, etc and none work -- all cause an immediate reboot. There's a BSOD for a fraction of a second, not long enough to read. I'm actually not too concerned about this, since I'm sure I can get things working again with a boot disk. I haven't even looked for one yet because I've been so busy with linux stuff.
On to that -- I had to fight tooth and nail to get get a new version of glib installed on onyx. I had 1.2.10 and 2.2.2 installed, and gtkpod (linux ipod software; supposedly works with the Shuffle) required gtk+ 2.4 or better. Well, gtk+ required glib 2.4 and pango and atk, but glib had to be installed before pango and atk.... etc. It was a big mess of software, and none of it installed right on first attempt. The problem was that the default install location when building glib from source is /usr/local, but my original Slackware installation came with glib installed to /usr. So even though glib installed just fine, gtkpod and the other programs kept giving errors that my glib was out of date, because they were finding the original glib in /usr. I tried to change where pkg-config looked for glib which fooled most of the ./configures but wouldn't actually work. I also tried to screw with my /etc/ld.so.conf, my $LD_LIBRARY_PATH, etc. Nothing worked, and I couldn't at first figure out why. Finally I randomly realized what was happening, 'make uninstall'ed and 'make clean'ed all the attempted installs and tried again with ./configure --prefix=/usr and it all worked.
...to no avail with gtkpod. Oh, it configured, made, and installed, but because the iPod isn't formatted yet gtkpod doesn't know where to put/how to store songs on it so I can play them. At least the program can see the Shuffle and move files to it. I'm optimistic that once I (FINALLY!) format it, I'll be able to use the iPod Shuffle with linux.
I thought that once I gave up on the iPod for a while I'd be done fscking with glib. This wasn't the case. In a bit of downtime this morning while I was waiting on ethereal to recompile (more on that later), I hacked the xmms source to add a function I've always wanted. Back in the day when Napster was young and desirable (not like now...), I used WinAmp for all my mp3 playing needs. WinAmp had a feature where you could press "Ctrl + V" which would stop playback at the end of the current track. I used to use it all the time (eg) as I was leaving my apartment so I wouldn't have to kill it midsong but I wouldn't have to leave it playing the whole time I was gone or modify my playlist manually. But xmms didn't (before now) have that capability.
Ctrl + V is already bound in xmms, to Visualizations. But Shift + V isn't -- in the source it's commented out but it's supposed to be a 'stop with fade' function. I spent half an hour or so in the source (input.c, input.h, main.c, playlist.c, and plugin.h) and added the "stopnext" capability. I modeled it mostly on the input_pause() function and variables. I had to add a variable to InputPluginData which I wanted to avoid, but it's the Best Way of doing what I want to do. I suppose I could use a thread and sleep for the rest of the current track or wait for the next track to play(), but I don't know how to code that really at all. So this should work.
I went to compile it and got a fscking glib error, saying it needs glib 1.2.2 or newer. I have 1.2.10 and 2.4.8, but in all my hacking around I hosed or buried my glib 1.2.10. I've been too busy with IAX and ethereal all day to try to sort it out. Perhaps tomorrow...
Besides my half-hour jaunt into xmms-land (which was interesting -- all the "real" C I've read has been Mark Spencer's, and this wasn't. I definitely noticed differences in coding styles.), today was an IAX day. I re-configured all 3 of my machines (sigma, onyx, wrt) to each have 2 unique IAX friends -- the other 2 machines. Before I had the same iax username:password for all 3 machines, and that just wasn't working. I couldn't tell who was doing what easily. So now onyx registers to sigma as onyx-sigma:ospass and to wrt as onyx-wrt:owpass, sigma registers to onyx as sigma-onyx:sopass and to wrt as sigma-wrt:swpass, and wrt registers as wrt-onyx:wopass and wrt-sigma:wspass. This makes my life far easier.
I have some funniness going on with the wrt. It doesn't register or allow registrations from either sigma or onyx. Not sure what that's about, as other traffic (web, ssh, icmp) works fine. I looked at the openwrt documentation I have cached on onyx and finally figured out how to permanently configure the essid (I was embarrassed to ever be running an access point with an essid of "linksys"). So now it's one everyone at school would recognize. : ) I think the registration difficulties may result from the preconfigured firewall on the wrt, which I haven't yet analyzed. I'll get there.
I now feel I've got a pretty good handle on the basics of IAX implementation. I looked at several ethereal dumps of IAX calls and noticed right away that the ethereal dissectors are quite out of date. After all, they are almost 6 months old -- that's an eternity in asterisk-land. : ) They're actually so out of date that ethereal-0.10.8 segfaults on me whenever I try to look at an IAX2 packet of type NEW. None of the other packets I looked at caused segfaults, but not all of them were right. About 25 Information Elements (IEs) are new since July 2004, when the dissector was written. And several of them are now basic to any IAX call. I first noticed that ethereal was misreporting the IE for the HANGUP packet, saying it was unknown when it should have specified what the CAUSECODE was. The old method of reporting the hangup cause was as a string in IE_CAUSE; nowadays there's a lookup list in include/asterisk/causes.h and IE_CAUSECODE is used. So I hacked ethereal's dissector (packet-iax2.c and .h) to include the causes list in the header and to handle it appropriately in the code. I was pretty excited when it worked on my first attempt -- again, this was working in non-markster code and it was harder for me to parse.
Later on I went back through and added code for all the "new" information elements. There are several of them that I have never seen in use and I didn't know what possible values would be for the ones of type string, so the updated dissector isn't as fleshed out as it could be. But it at least reports all the IEs I see properly. I'm going to look online when next I can to see if there's a newer version of ethereal, and if it includes a newer iax2 dissector. If it doesn't, perhaps I'll submit what I have for inclusion in the next release.
I'll definitely submit it if I can fix the segfault when parsing NEW packets. I used gdb for the first time tonight to try to debug ethereal to locate the segfault. I found it at once after I figured out how to invoke and run gdb. I'm impressed by this program -- I wish I would have started using it sooner.
I fired up ethereal in -X (hex + ascii) mode and literally hand parsed a few NEW packets to see in practice instead of in code what IEs they contain. That was a worthwhile and educational exercise. In just the half hour or so I was doing that I got to the point where I no longer had to reference notes or configs to read exactly what each packet said. I never thought I'd actually be able to "read" packets so quickly.
I had decided last night that the best use of my time in learning IAX right now would be to shift from just reading code to watching calls on the wire (or air, as the case may be) and diagramming each step of call setup, registration, etc. I got an email from BC this morning saying that he wanted someone to help him create IAX call flow diagrams -- exactly what I had started working on 12 hours previously. So I spent a few hours today making a thorough and pretty (for ASCII...) CFD for an IAX setup. It's not quite as generic as I'd like it to be because I include the specific authentication packets I use, which aren't the only possible ones. But that's easily changed, when I get around to it. I also made a complete iax registration CFD. Both will hopefully be online soon.
***Later...
I got ethereal to parse and display NEW packets without segfaulting, merely by commenting some AST_DATAFORMAT stuff in packet-iax2.c. There's no such thing as AST_DATAFORMAT anymore so I don't think I'm breaking anything by doing this.
