ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.46 by root, Sat Nov 28 12:40:22 2009 UTC vs.
Revision 1.47 by root, Wed Dec 30 13:37:53 2009 UTC

22 22
23 # node configuration: node ID 23 # node configuration: node ID
24 aemp setnodeid <nodeid> # configure the real node id 24 aemp setnodeid <nodeid> # configure the real node id
25 aemp delnodeid # reset node id to default (= inherit) 25 aemp delnodeid # reset node id to default (= inherit)
26 26
27 # node configuration: secret 27 # node configuration: authentication
28 aemp gensecret # generate a random shared secret 28 aemp gensecret # generate a random shared secret
29 aemp setsecret <secret> # set the shared secret 29 aemp setsecret <secret> # set the shared secret
30 aemp delsecret # remove the secret (= inherit) 30 aemp delsecret # remove the secret (= inherit)
31
32 # node configuration: TLS
33 aemp gencert # generate a random certificate 31 aemp gencert # generate a random certificate
34 aemp setcert <file> # set a certificate (key.pem + certificate.pem) 32 aemp setcert <file> # set a certificate (key.pem + certificate.pem)
35 aemp delcert # remove certificate (= inherit) 33 aemp delcert # remove certificate (= inherit)
36 34
37 # node configuration: seed addresses for bootstrapping 35 # node configuration: seed addresses for bootstrapping
50 aemp setservices initfunc,... # set service functions 48 aemp setservices initfunc,... # set service functions
51 aemp delservices # clear all services (= inherit) 49 aemp delservices # clear all services (= inherit)
52 aemp addservice <initfunc> # add an instance of a service 50 aemp addservice <initfunc> # add an instance of a service
53 aemp delservice <initfunc> # delete one instance of a service 51 aemp delservice <initfunc> # delete one instance of a service
54 52
55 # profile-specific configuration 53 # profile management
56 aemp profile <name> <command>... # apply command to profile only 54 aemp profile <name> <command>... # apply command to profile only
57 aemp setparent <name> # specify a parent profile 55 aemp setparent <name> # specify a parent profile
58 aemp delparent # clear parent again 56 aemp delparent # clear parent again
59 aemp delprofile <name> # eradicate the named profile 57 aemp delprofile <name> # eradicate the named profile
60 aemp showprofile <name> # display given profile 58 aemp showprofile <name> # display given profile
61 aemp showconfig <name> ... # display effective config 59 aemp showconfig <name> ... # display effective config
62 60
61 # node configuration: low-level protocol
62 aemp [set|del]monitor_timeout <seconds>
63 aemp [set|del]connect_interval <seconds>
64 aemp [set|del]framing_format [array]
65 aemp [set|del]auth_offer [array]
66 aemp [set|del]auth_accept [array]
67 aemp [set|del]autocork <boolean>
68 aemp [set|del]nodelay <boolean>
69
63=head1 DESCRIPTION 70=head1 DESCRIPTION
64 71
65With aemp you can configure various aspects of AnyEvent::MP and its 72With aemp you can configure various aspects of AnyEvent::MP and its
66protocol, send various messages and even run a node. 73protocol, send various messages and even run a node.
67 74
335Services are modules (or functions) that are automatically loaded (or 342Services are modules (or functions) that are automatically loaded (or
336executed) when a node starts. They are especially useful when used in 343executed) when a node starts. They are especially useful when used in
337conjunction with F<aemp run>, to configure which services a node should 344conjunction with F<aemp run>, to configure which services a node should
338run. 345run.
339 346
347Despite the daunting name, services really I<are> nothing more than a
348module name or a function name with arguments. The "service" aspect comes
349only from the behaviour of the module or function, which is supposed to
350implement, well, some kind of service for the node, network etc.
351
352Instead of writing a standalone program for each different node type in
353your network, you can simply put your code into a module, and then let the
354configuration decide which node runs which "services". This also makes it
355easy to combine multiple different services within the same node.
356
340=over 4 357=over 4
341 358
342=item setservices <initfunc>... 359=item setservices <initfunc>...
343 360
344Sets or replaces the list of services, which must be specified as a 361Sets or replaces the list of services, which must be specified as a
431Shows the I<effective> config, i.e. the values as used by a node started 448Shows the I<effective> config, i.e. the values as used by a node started
432with the given profile name. Any additional key-value pairs specified 449with the given profile name. Any additional key-value pairs specified
433augment the configuration, just as with C<configure>. 450augment the configuration, just as with C<configure>.
434 451
435If all arguments are omitted, show the global default config. 452If all arguments are omitted, show the global default config.
453
454=back
455
456=head2 LOW-LEVEL TRANSPORT PROTOCOL
457
458The low-level transport protocol betwene two nodes also has a number of
459configurable options, most of which should not be touched unless you know
460what you are doing.
461
462=over 4
463
464=item [set|del]monitor_timeout <seconds>
465
466Sets the default monitor timeout, that is, when a connection to a node
467cannot be established within this many seconds, the node is declared
468unreachable and all monitors will fire.
469
470C<30> seconds are usually a good time span for this.
471
472=item [set|del]connect_interval <seconds>
473
474When a connection cannot be established successfully within this many
475seconds, try the next transport address (e.g. the next IP address). If
476your nodes have a lot of transports, you might have to set this to a low
477value so that they will actually all be tried within the monitor timeout
478interval.
479
480C<2> is usually a good value, unless you live in new zealand.
481
482=item [set|del]framing_format [array]
483
484Configures the list of framing formats offered to the other side. This is
485simply a list of formatted read/write types used with L<AnyEvent::Handle>,
486in order of decreasing preference.
487
488Nodes support both C<json> and C<storable> framing formats for data
489packets out of the box, and usually choose C<json> because it is first in
490the list.
491
492Example: prefer the C<My::Personal::Format> framing format over JSON over
493Storable.
494
495 aemp setframing_format '["My::Personal::Format", "json", "storable"]'
496
497=item [set|del]auth_offer [array]
498
499Configures the list of authentication types that the node offers to the
500other side as acceptable, in order of decreasing preference. Only auth
501methods that the node can actually support will be offered.
502
503The default is '["tls_md6_64_256", "hmac_md6_64_256"]' and is usually good
504enough.
505
506=item [set|del]auth_accept [array]
507
508Configures the list of authentication types that remote nodes can use to
509authenticate, in order of decreasing preference.
510
511The default is '["tls_md6_64_256", "hmac_md6_64_256", "tls_anon",
512"cleartext"]' and is usually good enough.
513
514=item [set|del]autocork <boolean>
515
516Sets the default C<autocork> option value for the L<AnyEvent::Handle>
517object used by transports. By default, autocorking is off.
518
519=item [set|del]nodelay <boolean>
520
521Sets the default C<nodelay> option value for the L<AnyEvent::Handle>
522object used by transports. By default, nodelay is on.
436 523
437=back 524=back
438 525
439=cut 526=cut
440 527
861 _resolve => sub { 948 _resolve => sub {
862 print +(join ",", (AnyEvent::MP::Kernel::_resolve shift @ARGV)->recv), "\n"; 949 print +(join ",", (AnyEvent::MP::Kernel::_resolve shift @ARGV)->recv), "\n";
863 }, 950 },
864); 951);
865 952
953for my $attr (qw(
954 monitor_timeout connect_interval framing_format auth_offer
955 auth_accept autocork nodelay
956)) {
957 $CMD{"set$attr"} = sub {
958 @ARGV >= 1
959 or die "$attr value is missing\n";
960
961 $profile->{$attr} = shift @ARGV;
962 ++$cfg->{dirty};
963 };
964 $CMD{"del$attr"} = sub {
965 delete $profile->{$attr};
966 ++$cfg->{dirty};
967 };
968}
969
866for (keys %CMD) { 970for (keys %CMD) {
867 $CMD{$1} = $CMD{$_} if /^set(.*)$/; 971 $CMD{$1} = $CMD{$_} if /^set(.*)$/;
868} 972}
869 973
870sub docmd { 974sub docmd {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines