generate_packets.py: move field parsing code into Field class
Part of #43927. Replace parse_fields() with a Field.parse() classmethod.
Also did some style cleanup on all the lines I was touching and moving anyway.
Part of #43927. Replace parse_fields() with a Field.parse() classmethod.