Programmatical Grammar
Posted in MUD Development
First watch, 6 bells (11:15 pm)

I've been working on implementing boost::spirit in my MUD to parse complicated grammar. Once I figured out how the library worked, it wasn't difficult to add to my existing codebase. The complicated part comes from actually using the results of the grammar. Take the get command, for instance. Now that I have an easy-to-use grammar system, I can make it as complicated as I want. I currently support the following types of get commands:

I had to define a search order, too. If a player is carrying a container, and a similarly-named container also exists in the player's current room, the player can only manipulate the one in their inventory, and would have to first pick up container, then take items from it. I could work out a way to combine the inventories of the player and their location, but I'm not sure I want to go that far. Honestly, the way I've coded things it's not too difficult, but I'm more worried about perception of items and the confusion combining them all could potentially cause.

In any case, the get command is growing in complexity by orders of magnitude right now, and it's almost too much to keep in my head. I'm going to have to go through and refactor it before I've even finished writing it.

Here's a code example of one of my rules:

// 'get 20 items from container 2' grammar
rule5a = boost::spirit::int_p[boost::spirit::assign_a(mNumberToGet)] >> ' ' >>
	(+boost::spirit::alpha_p)[boost::spirit::assign_a(mItemToFind)] >> ' ' >>
	boost::spirit::str_p("from") >> ' ' >>
	(+boost::spirit::alpha_p)[boost::spirit::assign_a(mContainerToLookIn)] >> ' ' >>
	boost::spirit::int_p[boost::spirit::assign_a(mContainerNumber)];

Which reminds me, since this class (the get command) is a shared pointer, I have to lock up the volatile bits in a mutex so multiple threads play nice together.

Leave a Comment »
Cisco Firewall Issues
Posted in Tech
Afternoon watch, 3 bells (1:35 pm)

I've been working with my boss for quite a while on a router issue. We've spent hours on the phone with Cisco technicians trying to get this issue solved, and today it finally happened. The solution was deceptively simple, but I guess you need to get the right technician.

Our issue was this: a firewall was configured on a Cisco 881W router with NAT translation to pass Microsoft VPN traffic in to a VPN server on the inside of the firewall (port 1723). The problem is it never worked. The solution required GRE (which we knew), but finding a tech with the right qualifications to tell us exactly what to do was a right pain. We found if the firewall was shut off, then the VPN connection worked, so we knew there was an issue somewhere on the firewall itself.

Well, to make a long story short, here are the missing bits:

access-list 120 permit gre any any

class-map type inspect match-all GRE
   match access-group 120

policy-map type inspect NATOut-to-In
   class type inspect GRE
      pass

The number of the access list isn't important, as long as it isn't already used. The traffic has to be passed through via the policy map because it cannot be inspected. The NATOut-to-In is the rule for the firewall that handles outside to inside traffic. I don't know what yours may be named, but it should be something like that.

Leave a Comment »
Say Cheese!
Posted in General
Afternoon watch, 2 bells (1:28 pm)

Today I cracked open my 100th Anniversary Wheel of Tillamook Vintage White Extra Sharp cheese. I had some of it on my sandwich and it was awesome!

It's a little crumbly, but hey, it's 3 years old! The taste is magnificent. If you like sharp cheese, anyway. Can't wait to make a cheese sammich with it…

You can get your own here.

Leave a Comment »