Freeciv-3.3
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes
generate_packets.Packet Class Reference
+ Inheritance diagram for generate_packets.Packet:

Public Member Functions

 __init__ (self, ScriptConfig cfg, str packet_type, int packet_number, str flags_text, typing.Iterable[str] lines, typing.Callable[[str], RawFieldType] resolve_type)
 
str name (self)
 
bool no_packet (self)
 
str send_params (self)
 
str send_args (self)
 
str dsend_params (self)
 
str send_prototype (self)
 
str lsend_prototype (self)
 
str dsend_prototype (self)
 
str dlsend_prototype (self)
 
"set[str]" all_caps (self)
 
bool complex (self)
 
str get_struct (self)
 
str get_prototypes (self)
 
str get_stats (self)
 
str get_report_part (self)
 
str get_reset_part (self)
 
str get_init (self)
 
str get_free_destroy (self)
 
str get_send (self)
 
str get_variants (self)
 
str get_lsend (self)
 
str get_dsend (self)
 
str get_dlsend (self)
 

Data Fields

 cfg
 
 type
 
 type_number
 
 reset_packets
 
 is_info
 
 want_dsend
 
 want_lsend
 
 want_force
 
 want_pre_send
 
 want_post_send
 
 want_post_recv
 
 delta
 
 no_handle
 
 handle_via_packet
 
 handle_per_conn
 
 dirs
 
 all_fields
 
 fields
 
 variants
 

Static Public Attributes

 RESET_PATTERN = re.compile(r"^reset\((.*)\‍)$")
 
ScriptConfig cfg
 
str type
 
int type_number
 
str reset_packets : "list[str]"
 
str is_info = "no"
 
bool want_dsend = False
 
bool want_lsend = False
 
bool want_force = False
 
bool want_pre_send = False
 
bool want_post_send = False
 
bool want_post_recv = False
 
bool delta = True
 
bool no_handle = False
 
bool handle_via_packet = True
 
bool handle_per_conn = False
 
Directions dirs
 
str all_fields : "list[Field]"
 
str fields : "list[Field]"
 
str variants : "list[Variant]"
 

Detailed Description

Represents a single packet type (possibly with multiple variants)

Definition at line 3197 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.Packet.__init__ (   self,
ScriptConfig  cfg,
str  packet_type,
int  packet_number,
str  flags_text,
typing.Iterable[str lines,
typing.Callable[[str], RawFieldType resolve_type 
)

Reimplemented in generate_packets.PacketsDefinition.

Definition at line 3278 of file generate_packets.py.

Member Function Documentation

◆ all_caps()

"set[str]" generate_packets.Packet.all_caps (   self)
Set of all capabilities affecting this packet

Reimplemented in generate_packets.PacketsDefinition.

Definition at line 3447 of file generate_packets.py.

◆ complex()

bool generate_packets.Packet.complex (   self)
Whether this packet's struct requires special handling for
initialization, copying, and destruction.

Definition at line 3452 of file generate_packets.py.

◆ dlsend_prototype()

str generate_packets.Packet.dlsend_prototype (   self)
Prototype for the dlsend function (directly takes values; list of connections)

Definition at line 3440 of file generate_packets.py.

◆ dsend_params()

str generate_packets.Packet.dsend_params (   self)
Parameters for the dsend and dlsend functions, not including the
connection or list of connections to send to

Definition at line 3413 of file generate_packets.py.

◆ dsend_prototype()

str generate_packets.Packet.dsend_prototype (   self)
Prototype for the dsend function (directly takes values instead of a packet struct)

Definition at line 3434 of file generate_packets.py.

◆ get_dlsend()

str generate_packets.Packet.get_dlsend (   self)
Generate the implementation of the dlsend function, combining
dsend and lsend functionality.

See self.get_dsend() and self.get_lsend()

Definition at line 3650 of file generate_packets.py.

◆ get_dsend()

str generate_packets.Packet.get_dsend (   self)
Generate the implementation of the dsend function, which directly
takes packet fields instead of a packet struct.

Definition at line 3629 of file generate_packets.py.

◆ get_free_destroy()

str generate_packets.Packet.get_free_destroy (   self)
Generate this packet's free and destroy functions, which free
memory associated with complex-typed fields of this packet, and
optionally the allocation of the packet itself (destroy).

Definition at line 3536 of file generate_packets.py.

◆ get_init()

str generate_packets.Packet.get_init (   self)
Generate this packet's init function, which initializes the
packet struct so its complex-typed fields are usable, and sets
all fields to the empty default state used for computing deltas

Definition at line 3515 of file generate_packets.py.

◆ get_lsend()

str generate_packets.Packet.get_lsend (   self)
Generate the implementation of the lsend function, which takes
a list of connections to send a packet to.

Definition at line 3615 of file generate_packets.py.

◆ get_prototypes()

str generate_packets.Packet.get_prototypes (   self)
Generate the header prototype declarations for the public
functions associated with this packet.

Definition at line 3475 of file generate_packets.py.

◆ get_report_part()

str generate_packets.Packet.get_report_part (   self)
Generate this packet's part of the delta_stats_report() function.

See Variant.get_report_part() and
PacketsDefinition.code_delta_stats_report

Definition at line 3501 of file generate_packets.py.

◆ get_reset_part()

str generate_packets.Packet.get_reset_part (   self)
Generate this packet's part of the delta_stats_reset() function.

See Variant.get_reset_part() and
PacketsDefinition.code_delta_stats_reset

Definition at line 3508 of file generate_packets.py.

◆ get_send()

str generate_packets.Packet.get_send (   self)
Generate the implementation of the send function, which sends a
given packet to a given connection.

Definition at line 3569 of file generate_packets.py.

◆ get_stats()

str generate_packets.Packet.get_stats (   self)
Generate the code declaring counters for this packet's variants.

See Variant.get_stats()

Definition at line 3495 of file generate_packets.py.

◆ get_struct()

str generate_packets.Packet.get_struct (   self)
Generate the struct definition for this packet

Definition at line 3457 of file generate_packets.py.

◆ get_variants()

str generate_packets.Packet.get_variants (   self)
Generate all code associated with individual variants of this
packet; see the Variant class (and its methods) for details.

Definition at line 3597 of file generate_packets.py.

◆ lsend_prototype()

str generate_packets.Packet.lsend_prototype (   self)
Prototype for the lsend function (takes a list of connections)

Definition at line 3428 of file generate_packets.py.

◆ name()

str generate_packets.Packet.name (   self)
Snake-case name of this packet type

Definition at line 3379 of file generate_packets.py.

◆ no_packet()

bool generate_packets.Packet.no_packet (   self)
Whether this packet's send functions should take no packet
argument. This is the case iff this packet has no fields.

Definition at line 3384 of file generate_packets.py.

◆ send_args()

str generate_packets.Packet.send_args (   self)
Arguments passed from lsend to send, not including the
connection to send to

See also extra_send_args

Definition at line 3400 of file generate_packets.py.

◆ send_params()

str generate_packets.Packet.send_params (   self)
Parameters for the send and lsend functions, not including the
connection or list of connections to send to

Definition at line 3390 of file generate_packets.py.

◆ send_prototype()

str generate_packets.Packet.send_prototype (   self)
Prototype for the regular send function

Definition at line 3423 of file generate_packets.py.

Field Documentation

◆ all_fields [1/2]

str generate_packets.Packet.all_fields : "list[Field]"
static

Definition at line 3265 of file generate_packets.py.

◆ all_fields [2/2]

generate_packets.Packet.all_fields

Definition at line 3351 of file generate_packets.py.

◆ cfg [1/2]

ScriptConfig generate_packets.Packet.cfg
static

Definition at line 3206 of file generate_packets.py.

◆ cfg [2/2]

generate_packets.Packet.cfg

Definition at line 3280 of file generate_packets.py.

◆ delta [1/2]

bool generate_packets.Packet.delta = True
static

Definition at line 3248 of file generate_packets.py.

◆ delta [2/2]

generate_packets.Packet.delta

Definition at line 3320 of file generate_packets.py.

◆ dirs [1/2]

Directions generate_packets.Packet.dirs
static

Definition at line 3262 of file generate_packets.py.

◆ dirs [2/2]

generate_packets.Packet.dirs

Definition at line 3341 of file generate_packets.py.

◆ fields [1/2]

str generate_packets.Packet.fields : "list[Field]"
static

Definition at line 3272 of file generate_packets.py.

◆ fields [2/2]

generate_packets.Packet.fields

Definition at line 3353 of file generate_packets.py.

◆ handle_per_conn [1/2]

bool generate_packets.Packet.handle_per_conn = False
static

Definition at line 3258 of file generate_packets.py.

◆ handle_per_conn [2/2]

generate_packets.Packet.handle_per_conn

Definition at line 3329 of file generate_packets.py.

◆ handle_via_packet [1/2]

bool generate_packets.Packet.handle_via_packet = True
static

Definition at line 3254 of file generate_packets.py.

◆ handle_via_packet [2/2]

generate_packets.Packet.handle_via_packet

Definition at line 3326 of file generate_packets.py.

◆ is_info [1/2]

str generate_packets.Packet.is_info = "no"
static

Definition at line 3222 of file generate_packets.py.

◆ is_info [2/2]

generate_packets.Packet.is_info

Definition at line 3296 of file generate_packets.py.

◆ no_handle [1/2]

bool generate_packets.Packet.no_handle = False
static

Definition at line 3251 of file generate_packets.py.

◆ no_handle [2/2]

generate_packets.Packet.no_handle

Definition at line 3323 of file generate_packets.py.

◆ reset_packets [1/2]

str generate_packets.Packet.reset_packets : "list[str]"
static

Definition at line 3218 of file generate_packets.py.

◆ reset_packets [2/2]

generate_packets.Packet.reset_packets

Definition at line 3284 of file generate_packets.py.

◆ RESET_PATTERN

generate_packets.Packet.RESET_PATTERN = re.compile(r"^reset\((.*)\‍)$")
static

Definition at line 3200 of file generate_packets.py.

◆ type [1/2]

str generate_packets.Packet.type
static

Definition at line 3209 of file generate_packets.py.

◆ type [2/2]

generate_packets.Packet.type

Definition at line 3281 of file generate_packets.py.

◆ type_number [1/2]

int generate_packets.Packet.type_number
static

Definition at line 3215 of file generate_packets.py.

◆ type_number [2/2]

generate_packets.Packet.type_number

Definition at line 3282 of file generate_packets.py.

◆ variants [1/2]

str generate_packets.Packet.variants : "list[Variant]"
static

Definition at line 3275 of file generate_packets.py.

◆ variants [2/2]

generate_packets.Packet.variants

Definition at line 3373 of file generate_packets.py.

◆ want_dsend [1/2]

bool generate_packets.Packet.want_dsend = False
static

Definition at line 3226 of file generate_packets.py.

◆ want_dsend [2/2]

generate_packets.Packet.want_dsend

Definition at line 3302 of file generate_packets.py.

◆ want_force [1/2]

bool generate_packets.Packet.want_force = False
static

Definition at line 3234 of file generate_packets.py.

◆ want_force [2/2]

generate_packets.Packet.want_force

Definition at line 3308 of file generate_packets.py.

◆ want_lsend [1/2]

bool generate_packets.Packet.want_lsend = False
static

Definition at line 3230 of file generate_packets.py.

◆ want_lsend [2/2]

generate_packets.Packet.want_lsend

Definition at line 3305 of file generate_packets.py.

◆ want_post_recv [1/2]

bool generate_packets.Packet.want_post_recv = False
static

Definition at line 3244 of file generate_packets.py.

◆ want_post_recv [2/2]

generate_packets.Packet.want_post_recv

Definition at line 3317 of file generate_packets.py.

◆ want_post_send [1/2]

bool generate_packets.Packet.want_post_send = False
static

Definition at line 3241 of file generate_packets.py.

◆ want_post_send [2/2]

generate_packets.Packet.want_post_send

Definition at line 3314 of file generate_packets.py.

◆ want_pre_send [1/2]

bool generate_packets.Packet.want_pre_send = False
static

Definition at line 3238 of file generate_packets.py.

◆ want_pre_send [2/2]

generate_packets.Packet.want_pre_send

Definition at line 3311 of file generate_packets.py.