Mail-Cclient-1.12/0000755000076400007640000000000010132021657014337 5ustar wwwadminweb00000000000000Mail-Cclient-1.12/t/0000755000076400007640000000000010132021657014602 5ustar wwwadminweb00000000000000Mail-Cclient-1.12/t/rfc822_base64.t0000644000076400007640000000023007535637261017155 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_base64); print "1..2\n"; print "ok 1\n"; rfc822_base64("SXN0byDpIHVtIHRlc3RlISEhDQo=") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/fetch_message.t0000644000076400007640000000046407535376341017610 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->fetch_message(1) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/fetch_header.t0000644000076400007640000000046307535353726017415 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->fetch_header(1) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/ping.t0000644000076400007640000000044707462220636015743 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->ping or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/rfc822_write_address.t0000644000076400007640000000025307461254471020731 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_write_address); print "1..2\n"; print "ok 1\n"; rfc822_write_address("hdias", "xyz.org", "Henrique Dias") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/parameters.t0000644000076400007640000000033607461254471017151 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..3\n"; print "ok 1\n"; Mail::Cclient::parameters(undef,'USERNAME' => "hdias") or print "not "; print "ok 2\n"; Mail::Cclient::parameters(undef,'USERNAME') or print "not "; print "ok 3\n"; Mail-Cclient-1.12/t/fetch_text.t0000644000076400007640000000046107535437074017146 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->fetch_text(1) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/rfc822_binary.t0000644000076400007640000000023307657745424017366 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_binary); print "1..2\n"; print "ok 1\n"; rfc822_binary("Test latin chars: áéíóúãõçâêîôû") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/fetch_mime.t0000644000076400007640000000047407535627501017111 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test_mpart.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->fetch_mime(1, "2") or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/rfc822_qprint.t0000644000076400007640000000022007535653034017401 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_qprint); print "1..2\n"; print "ok 1\n"; rfc822_qprint("Isto =E9 um teste!!!") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/unsubscribe.t0000644000076400007640000000047107462220313017317 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->unsubscribe($mailbox) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/rfc822_parse_adrlist.t0000644000076400007640000000026407461254471020730 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_parse_adrlist); print "1..2\n"; print "ok 1\n"; rfc822_parse_adrlist("Henrique Dias ", "xyz.org") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/thread.t0000644000076400007640000000056007462220334016244 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->thread( THREADING => "references", SEARCH => "ALL", FLAG => "uid") or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/expunge.t0000644000076400007640000000062207461513026016451 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); print "1..5\n"; print "ok 1\n"; set_callback( log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, ); print "ok 2\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 3\n"; $c->expunge; print "ok 4\n"; $c->close(); print "ok 5\n"; undef($c); Mail-Cclient-1.12/t/rfc822_8bit.t0000644000076400007640000000020007657745436016745 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_8bit); print "1..2\n"; print "ok 1\n"; rfc822_8bit("Orquídea") or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/nmsgs.t0000644000076400007640000000045007462220615016124 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->nmsgs or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/check.t0000644000076400007640000000062107461513737016063 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); print "1..5\n"; print "ok 1\n"; set_callback( log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, ); print "ok 2\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 3\n"; $c->check; print "ok 4\n"; $c->close(); print "ok 5\n"; undef($c); Mail-Cclient-1.12/t/fetch_body.t0000644000076400007640000000046607535353533017121 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->fetch_body(1, "1") or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/search.t0000644000076400007640000000104207461513143016240 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); print "1..6\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my @sequence = (); set_callback( 'searched' => sub { my ($stream, $number) = @_; push(@sequence, $number); } ); print "ok 2\n"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 3\n"; $c->search( SEARCH => "ALL NOT FROM \"hdias\"", FLAG => ["uid"]); print "ok 4\n"; unless(@sequence) { print "not "; } print "ok 5\n"; $c->close(); print "ok 6\n"; undef($c); Mail-Cclient-1.12/t/utf8_mime2text.t0000644000076400007640000000025707461254471017674 0ustar wwwadminweb00000000000000use Mail::Cclient qw(utf8_mime2text); print "1..2\n"; print "ok 1\n"; utf8_mime2text('=?utf-8?B?QW5kculh?= ') or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/fetch_structure.t0000644000076400007640000000053607535436016020220 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; my ($env, $body) = $c->fetch_structure(1); print "not " unless($env || $body); print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/rfc822_date.t0000644000076400007640000000016407461254471017010 0ustar wwwadminweb00000000000000use Mail::Cclient qw(rfc822_date); print "1..2\n"; print "ok 1\n"; rfc822_date or print "not "; print "ok 2\n"; Mail-Cclient-1.12/t/search_msg.t0000644000076400007640000000050407462220416017107 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->search_msg(1, "TEXT \"testing\"") or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/uid.t0000644000076400007640000000045107462220324015554 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->uid(1) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/msgno.t0000644000076400007640000000054607462220604016124 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..5\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; my $uid = $c->uid(1) or print "not "; print "ok 3\n"; $c->msgno($uid) or print "not "; print "ok 4\n"; $c->close(); print "ok 5\n"; undef($c); Mail-Cclient-1.12/t/smtp_open.t0000644000076400007640000000035010123565356017002 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..3\n"; print "ok 1\n"; my $smtp = Mail::Cclient::SMTP->new( hostlist => "rosa.aesbuc.pt", service => "smtp", options => "dsn", ); print "ok 2\n"; $smtp->close(); print "ok 3\n"; undef($smtp); Mail-Cclient-1.12/t/list.t0000644000076400007640000000057707461513042015760 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); print "1..5\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; set_callback( list => sub {shift; print "list: @_\n";}, ); print "ok 2\n"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 3\n"; $c->list("", "%"); print "ok 4\n"; $c->close(); print "ok 5\n"; undef($c); Mail-Cclient-1.12/t/elt.t0000644000076400007640000000045207462220237015563 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->elt(1) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/sort.t0000644000076400007640000000055307462220400015760 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->sort( SORT => ["from", 0, "size", 1, "subject", 0], SEARCH => "ALL") or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/t/subscribe.t0000644000076400007640000000046707462220346016767 0ustar wwwadminweb00000000000000use Mail::Cclient; print "1..4\n"; print "ok 1\n"; my $pwd = `pwd`; chomp($pwd); my $mailbox = "$pwd/testmbx/test.mbox"; my $c = Mail::Cclient->new($mailbox, 'readonly') or print "not "; print "ok 2\n"; $c->subscribe($mailbox) or print "not "; print "ok 3\n"; $c->close(); print "ok 4\n"; undef($c); Mail-Cclient-1.12/Changes0000644000076400007640000001444510132021132015626 0ustar wwwadminweb00000000000000Revision history for Perl extension Mail::Cclient. 1.12 09 Oct 2004 * A serious bug that caused a crash after compilation in "x86_64-linux" architecture was fixed. * The information in README file was updated. * The Makefile.PL has changed again. 1.11 06 Oct 2004 * The line '#include "utf8.h"' in "Cclient.xs" file was moved to line after the '#include "perl.h"' to avoid problems in the "x86_64-linux" architecture. * The content of imap "linkage.c" file has been added to "Cclient.xs", because it is not installed in many OS's. * The Makefile.PL has changed 1.10 20 Sep 2004 * The function make_mail_body has been updated (the XS perl internal function AvFill was deprecated and has been replaced by av_len function). * Small documentation improvements. * The example script smtp_mail.pl was updated. * A bug has been fixed in XS make_mail_body function. * The Makefile.PL has been fixed to compile in AIX. (Thanks to Peter Arien ) 1.9 20 Apr 2004 * Use of uninitialized value in subroutine open_full as been fixed. * Examples to fetch structure and body parts of message in a mailbox were added. 1.8 14 Jun 2003 * rfc822_8bit and rfc822_binary methods are added. * The SMTP API was changed (code submitted by Andrew Schretter ) * Test script to smtp_open function was added. * New examples for smtp were added * Documentation update. 1.7 14 Sep 2002 * Added more test scripts. * fetch_message and fetch_mime methods are added. * The API of following methods are changed: fetchstructure, fetchheader, fetchtext, fetchbody, fetchflags and fetchfast. * Fixed the problem with rfc822_qprint and rfc822_base64 functions which was causing a core dump. * Fixed mail_append() parameter order which was causing appends to IMAP mailboxes not to work. (code from Gombas Gabor, submitted by Jaldhar H. Vyas ) * imapdate method was added to Mail::CClient::Elt. (code from Gombas Gabor, submitted by Jaldhar H. Vyas ) * Corrected a error in the documentation. The call back for the search function was listed as "search" when explaining the search function, but "searched" under the callback section. (Thanks to David Harris ) * Documentation update. 1.6 26 Apr 2002 * The make_thread function was rewritten. (from code submitted by Raul Dias ) * Added "t" directory and test scripts. * Added "testmbx" directory and a mailbox file for tests. 1.5 01 Dec 2001 * Documentation update. * Added parameters SSHTIMEOUT and SSLFAILURE to parameters method. * Added flags "secure" and "tryssl" to open method. * Addes PNG image type to set_mime_type function (XS). (from code submitted by Helena Gomes ) * Fixed bug in mail__parameters function. Changed keyword from CODE to PPCODE. Thanks Dmitry Mottl * Added utf8_mime2text method and utf8_mime2text.pl example. (from code submitted by Raul Dias ) 1.4.1 31 Oct 2001 * Added file FAQ * Added the option --with-kerberos to the Makefile.PL (from code submitted by Helena Gomes ) * Added the option --with-shared_cclient to the Makefile.PL (from code submitted by Jaldhar H. Vyas ) 1.4 22 Oct 2001 * Added rfc822_output method * Added support for SMTP API * Safemalloc have been removed from mail_sort function * Full support for all "rfc2060" search keys (from code submitted by Helena Gomes ) * documentation updated (new pod file) * example updated * new Makefile.PL with options for pam and ssl 1.3 23 Jul 2001 (version 1.3 submitted by Henrique Dias ) * changed wrong flag "FT_NOT" to "FT_PEEK" in internal XS functions mail_fetchtext and mail_fetchbody, thanks to Le-Sueur Phil * Updated the documentation and fixed a 'bug' in text * Added $mc->search_msg method (from code submitted by Helena Gomes ) * Added DRAFT, LARGER, SENTBEFORE, SENTON, SENTSINCE, SMALLER, UNDRAFT, NOT and OR to search criteria. (submitted by Helena Gomes ) 1.2 05 Jul 2001 (version 1.2 submitted by Henrique Dias ) * Updated the documentation * Added rfc822_write_address and rfc822_parse_adrlist to @EXPORT_OK. * Added $mc->msgno method * Added $mc->thread method * Added $mc->sort method * Updated $mc->search method Now support the more advanced search specifications 1.1 31 Oct 2000 * Added "search" method. * Fixed documentation to match tightened MIME message/rfc822 check. * Renamed "t" directory to "examples". * Added rfc822_date to @EXPORT_OK and documentation. 1.0 10 May 2000 * Make the elt method fill in a flag name of the form "user_flag_%d" when a message's flag bitmap has a bit set which does not correspond to a name in the stream's user_flags array. * Tighten check for MIME non-multipart nested messages from message/* to message/rfc822. * Define PERL_POLLUTE so that na and sv_undef are defined for Perl 5.6. * Bump version to 1.0 since it's been working decently for a couple of years without major changes. 0.6 17 Jun 1999 * Added rfc822_date function (without which it's difficult to get hold of a date which includes the timezone name) * Added $body->disposition to get content-disposition information 0.5 7 Jun 1999 * $mc->status method was calling back "log" instead of "status" * Added documentation on the $mc->open method * The mailstream2sv HV was caching stale objects and the DESTROY method was then causing closes on those stale streams at program exit. That led to segfaults. Stale streams are now deleted from the hash and the destructor has been removed since there's no nice way to keep it clean. 0.4 14 Sep 1998 * Added support for mail_parameters * Added $mc->append method (from code submitted by Kevin Sullivan ) * Added CAVEATS section to documentation (submitted by Bruce Gingery ) * Attempt to work around possible NULL parts in make_body for TYPEMESSAGE. 0.3 1 Jun 1998 * Created this Changes file * Removed duplicate decrement in av_to_stringlist which was causing fetchheader to return only half the requested headers * Add support for elts 0.2 14 Apr 1998 * Polished up for public release. 0.1 * First internal version Mail-Cclient-1.12/examples/0000755000076400007640000000000010132021657016155 5ustar wwwadminweb00000000000000Mail-Cclient-1.12/examples/smtp_mail.pl0000755000076400007640000000136010132020250020466 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient; my $smtp = Mail::Cclient::SMTP->new( hostlist => ["smtp1.perl.org", "smtp2.perl.org"], service => "smtp", port => 25 ); $smtp->mail( transaction => "mail", defaulthost => "smtp1.perl.org", envelope => { from => "hdias\@perl.org", to => "hdias\@aesbuc.pt", subject => "this is a test", }, body => { content_type => "text/plain", language => ["en", "pt"], location => "http://search.cpan.org/CPAN/authors/id/H/HD/HDIAS/Mail-Cclient-1.12.tar.gz", md5 => "7YtYbnB1w9PvjMd4qbUkcg==", id => "<8CBACA69-45C3-49C8-B182-D6A99CD9B40D>", encoding => "quoted-printable", data => "This is the data...", } ); $smtp->close(); exit(0); Mail-Cclient-1.12/examples/imap.txt0000644000076400007640000000105106514217431017647 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); set_callback log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" }, list => sub { shift; print "list: @_\n"; }, login => sub { my ($username, $password); local($|) = 1; print "Username: "; chomp($username = ); print "Password: "; chomp($password = ); return ($username, $password); }; $c = Mail::Cclient->new('{localhost/imap}INBOX') or die "Mail::Cclient->new failed\n"; $c->list("", "%"); Mail-Cclient-1.12/examples/rfc822_date.pl0000755000076400007640000000014507361264145020533 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient qw(rfc822_date); $date = rfc822_date; print "$date\n"; exit(); Mail-Cclient-1.12/examples/fetch_structure.pl0000755000076400007640000000503410041242342021723 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient qw(set_callback); my $pwd = `pwd`; chomp($pwd); $pwd =~ s/\/examples//; my $mailbox = "$pwd/testmbx/multipart.mbox"; set_callback( log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" } ); my $c = Mail::Cclient->new($mailbox, 'readonly'); my ($env, $body) = $c->fetch_structure(1, "uid") or die("$!"); print " From: ", addr($env->from), "\n", print " To: ", addr($env->to), "\n"; print "Subject: ", $env->subject, "\n"; print "\n"; my $parts = &init_structure($body); for my $k (sort(keys(%{$parts}))) { print "Part ($k)\n"; print " Filename: ", $parts->{$k}->{'filename'}, "\n"; print " Size: ", $parts->{$k}->{'size'}, "\n"; print " Encoding: ", $parts->{$k}->{'encoding'}, "\n"; print " Mime Type: ", $parts->{$k}->{'mime_type'}, "\n"; print "Disposition: ", $parts->{$k}->{'disposition'}, "\n"; print "Description: ", $parts->{$k}->{'description'}, "\n"; print " Parameter: ", $parts->{$k}->{'parameter'}, "\n"; print "\n"; } $c->close(); exit(); sub addr { my $alist = shift; return join(", ", map { sprintf('%s@%s (%s)', $_->mailbox, $_->host, $_->personal) } @$alist); } sub init_structure { my $body = shift; my %hash = (); &output_structure(\%hash, "", $body); return(\%hash); } sub output_structure { my $hash = shift; my $id = shift; my $body = shift; my $type = lc($body->type); if($type eq "multipart") { $id = join("\.", $id, "") if($id); my $nested = $body->nested; my $count = scalar(@{$nested}); for(my $i = 1; $i <= $count; $i++) { &output_structure($hash, "$id$i", $nested->[$i - 1]); } } else { $id = "1" unless($id); my ($filename, $disposition) = ("", ""); my ($array, $description) = ($body->disposition, $body->description); for my $i (0 .. $#{@$array}) { $disposition = $array->[$i] if(lc($array->[$i]) eq "attachment" || lc($array->[$i]) eq "inline"); $filename = $array->[$i+1] if(lc($array->[$i]) eq "filename"); } unless($filename) { my %p = @{$body->parameter}; $filename = $p{'NAME'} if(exists($p{'NAME'})); } $hash->{$id} = { size => $body->bytes, mime_type => join("/", $type, lc($body->subtype)), disposition => $disposition, description => $description, filename => $filename || $description, encoding => $body->encoding, parameters => $body->parameter, }; my $parts = $body->nested; if($parts->[1]) { $id = join("\.", $id, "1") if(lc($parts->[1]->type) ne "multipart"); &output_structure($hash, $id, $parts->[1]); } } } Mail-Cclient-1.12/examples/mime.txt0000644000076400007640000000072707540352543017665 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); set_callback log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" }; if (@ARGV < 3) { print STDERR "Usage: mime.t mailstream msgno section ...\n"; exit 2; } my $stream = shift; my $msgno = shift; $c = Mail::Cclient->new($stream) or die "can't open mailstream $stream\n"; while ($section = shift) { print "*** $section ***\n", $c->fetch_body($msgno, $section); } Mail-Cclient-1.12/examples/rfc822_parse_adrlist.pl0000755000076400007640000000064407321302376022451 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient qw(rfc822_parse_adrlist); my $addr = "Henrique Dias , postmaster\@xyz.org, root", "xyz.org"; my $list = rfc822_parse_adrlist($addr, "xyz.org"); for(@{$list}) { print "Personal:" . $_->personal . "\n"; print " Adl:" . $_->adl . "\n"; print " Mailbox:" . $_->mailbox . "\n"; print " Host:" . $_->host . "\n"; print " Error:" . $_->error . "\n"; } exit(); Mail-Cclient-1.12/examples/smtp_mail_append.txt0000755000076400007640000000323307657744440022262 0ustar wwwadminweb00000000000000# this is a example use Mail::Cclient; my @attachs = ( { content_type => "image/gif", filename => "image.gif", encoding => "binary", path => "files/image.gif", }, { content_type => "image/jpeg", filename => "image.jpg", encoding => "binary", path => "files/image.jpg", }, ); my $envelope = { from => "hdias@aeiou.pt", to => "xyz@perl.com", cc => "abc@perl.com", subject => "another test", }; my $data = "bla bla bla"; my $signature = "\n\n--\n--Henrique Dias--\n"; my $body = { content_type => "text/plain", encoding => "quoted-printable", data => $data . $signature, } my $i = 0; my $part = []; for my $attach (@attachs) { $part->[$i++] = { content_type => $attach->{'content_type'}, disposition => { type => "attachment", parameter => [{ attribute => "filename", value => $attach->{'filename'}, }], }, encoding => $attach->{'encoding'}, path => $attach->{'path'}, parameter => [{ attribute => "name", value => $attach->{'filename'}, }], }; } if(scalar(@{$part})) { unshift(@{$part}, $body); $body = { content_type => "multipart/mixed", part => $part, }; } my $smtp = Mail::Cclient::SMTP->new( hostlist => ["smtp.aeiou.pt"] ); open(FILE, ">tmp.rfc822") or die "$!\n"; my $fh = *FILE; $smtp->mail( filehandle => $fh, envelope => $envelope, body => $body, ); seek($fh, 0, 0); local $/ = undef; my $text = <$fh>; close(FILE); $smtp->close(); # Append the message to mailbox my $msg2mb = "sent-mail"; my $mailbox = "{mail.aeiou.pt/imap}mail/$msg2mb"; $cclient->append($mailbox, $text); exit(0); Mail-Cclient-1.12/examples/smtp_mail_mpart.pl0000755000076400007640000000212607657744451021734 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient; my $smtp = Mail::Cclient::SMTP->new( hostlist => ["smtp1.perl.org","smtp2.perl.org"], port => 25 ); $smtp->mail( transaction => "mail", defaulthost => "perl.org", envelope => { from => "hdias\@perl.org", to => "mallocom\@perl.org", cc => "", subject => "this is a test", return_path => "", }, body => { content_type => "multipart/mixed", part => [{ content_type => "image/jpeg", encoding => "binary", disposition => { type => "attachment", parameter => [{ attribute => "filename", value => "test.jpg", }, { attribute => "autor", value => "Henrique", } ], }, parameter => [ { attribute => "name", value => "test.jpg", } ], description => "Eu sou a descricao!", path => "/home/users/hdias/test.jpg", }, { content_type => "text/plain", encoding => "quoted-printable", data => "This is the data...", }, ], } ); $smtp->close(); exit(0); Mail-Cclient-1.12/examples/thread_test.pl0000755000076400007640000000211507540352773021041 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient; use Data::Dumper; use strict; die "Could not find test.mbox to test it!\n" unless (-f "../testmbx/test.mbox"); my $result = '$VAR1 = [ [ 1430, 1432 ], [ [ 1, 2, 3 ], [ 4 ] ], [ 104, [ 105 ], [ 106, 111, 121, 139 ], [ 108, 109, 110 ] ], [ 159, [ 160, 162, [ 163, 165 ], [ 164, 166 ] ], [ 161 ] ], [ 204, [ 205 ], [ 208, 209, 210, 212, [ 214, 216, 217, 220 ], [ 215 ] ] ], [ 334, [ 338 ], [ 419 ], [ 472, 476, [ 479, 485, 486 ], [ 492 ] ] ] ];'; print <thread( THREADING => "references", FLAG => "uid" ); $data =~ s/\n//g; $data =~ s/\s+/ /g; print "$data\n\n"; if($data eq $result) { print "They match.\n"; } else{ print "Warning! They are not the same!\n"; } Mail-Cclient-1.12/examples/search_msg.txt0000644000076400007640000000073107322330024021030 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); # look for Perl in TEXT. set_callback log => sub { my ($str, $type) = @_; print "$type: $str"; }; if($cclient->search_msg(559, "TEXT \"Perl\"")) { print "Perl exist...\n"; } else { print "Perl not found!\n"; } # look for Perl in SUBJECT and Larry in TEXT. my $res = $cclient->search_msg(559, "SUBJECT \"Perl\" TEXT \"Larry\"")) { if($res) { print "Perl exist...\n"; } else { print "Perl not found!\n"; } Mail-Cclient-1.12/examples/summ.txt0000644000076400007640000000071507540352733017715 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); set_callback log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" }; if (@ARGV != 1) { print STDERR "Usage: summ.t mailstream\n"; exit 2; } $c = Mail::Cclient->new($ARGV[0]) or die "can't open mailstream $ARGV[0]\n"; $nmsgs = $c->nmsgs; for ($i = 1; $i <= $nmsgs; $i++) { print "$i\n", $c->fetch_header($i, ["Subject"]), $c->fetch_text($i), "---\n"; } Mail-Cclient-1.12/examples/utf8_mime2text.pl0000755000076400007640000000063707402214213021405 0ustar wwwadminweb00000000000000#!/usr/bin/perl -w use Mail::Cclient qw(utf8_mime2text); my @mime2 = ('=?utf-8?B?QW5kculh?= ,', '=?utf-8?B?QW5kcuk=?= ', '=?utf-8?Q?Eul=E1lia_Vieira_de_Camargo?= ,', '=?utf-8?B?QW5kcuk=?= ', ); foreach (@mime2){ print "Original mime2 string: $_\n"; print "Converted text : " . utf8_mime2text($_) . "\n"; print "\n"; } Mail-Cclient-1.12/examples/rfc822_write_address.pl0000755000076400007640000000034207321302376022447 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient qw(rfc822_write_address); my $mailbox = "hdias"; my $host = "xyz.org"; my $personal = "Henrique Dias"; my $str = rfc822_write_address($mailbox, $host, $personal); print "$str\n"; exit(); Mail-Cclient-1.12/examples/fetch_body.pl0000755000076400007640000000165110041246377020635 0ustar wwwadminweb00000000000000#!/usr/bin/perl use Mail::Cclient qw(set_callback rfc822_base64); my $pwd = `pwd`; chomp($pwd); $pwd =~ s/\/examples//; my $mailbox = "$pwd/testmbx/multipart.mbox"; set_callback( log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" } ); my $c = Mail::Cclient->new($mailbox, 'readonly'); # MIME section specifier (#.#.#...# = 3) my $body = $c->fetch_body(1, "3", "uid") or die("Error: $!"); &decode_body_in_place("BASE64", $body); my $filedest = "image.gif"; open(FILE, ">$filedest") or die("can't open $filedest: $!"); print FILE $body; close(FILE); exit(); sub decode_body_in_place { my $encoding = lc(shift); ($encoding and defined($_[0]) and length($_[0])) or return(); for($_[0]) { if($encoding eq "base64") { $_ = rfc822_base64($_); } elsif($encoding eq "quoted-printable") { s/[ \t]*\r?$//mg; s/=\n//sg; s/=([0-9a-fA-F]{2})/chr(hex($1))/ge; } } } Mail-Cclient-1.12/examples/copy.txt0000644000076400007640000000064706514217340017704 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); set_callback log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" }; if (@ARGV != 3) { print STDERR "Usage: copy.t mailstream msgno destmailbox\n"; exit 2; } my ($stream, $msgno, $dest) = @ARGV; $c = Mail::Cclient->new($stream) or die "can't open mailstream $stream\n"; $c->copy($msgno, $dest) or die "copy failed\n"; Mail-Cclient-1.12/examples/list_mailboxs.pl0000755000076400007640000000140507672637361021412 0ustar wwwadminweb00000000000000#!/usr/bin/perl use strict; use Mail::Cclient qw(set_callback); unless(scalar(@ARGV) == 3) { print STDERR "Usage: ./list_mailboxs.pl host user password\n"; exit(2); } my ($host, $user, $passwd) = @ARGV; my $ref = "\{$host/imap\}"; my $stream = join("", $ref, "INBOX"); my $pat = join("/", "mail", "%"); set_callback( 'login' => sub { return($user, $passwd); }, 'dlog' => sub { print STDERR "debug: $_[0]\n"; }, 'log' => sub { my ($string, $type) = @_; print STDERR "$type: $string\n"; }, 'list' => sub { shift; print "list: @_\n"; } ); Mail::Cclient::parameters(undef, RSHTIMEOUT => 0, MAXLOGINTRIALS => 1); my $cclient = Mail::Cclient->new($stream) or die("Mail::Cclient->new failed\n"); $cclient->list($ref, $pat); $cclient->close; exit(); Mail-Cclient-1.12/examples/rfc822_output.txt0000755000076400007640000000315507363255100021357 0ustar wwwadminweb00000000000000# this is a example use Mail::Cclient qw(rfc822_output); my @attachs = ( { content_type => "image/gif", filename => "image.gif", encoding => "binary", path => "files/image.gif", }, { content_type => "image/jpeg", filename => "image.jpg", encoding => "binary", path => "files/image.jpg", }, ); my $envelope = { from => "hdias@aeiou.pt", to => "xyz@perl.com", cc => "abc@perl.com", subject => "another test", }; my $data = "bla bla bla"; my $signature = "\n\n--\n--Henrique Dias--\n"; my $body = { content_type => "text/plain", encoding => "quoted-printable", data => $data . $signature, } my $i = 0; my $part = []; for my $attach (@attachs) { $part->[$i++] = { content_type => $attach->{'content_type'}, disposition => { type => "attachment", parameter => [{ attribute => "filename", value => $attach->{'filename'}, }], }, encoding => $attach->{'encoding'}, path => $attach->{'path'}, parameter => [{ attribute => "name", value => $attach->{'filename'}, }], }; } if(scalar(@{$part})) { unshift(@{$part}, $body); $body = { content_type => "multipart/mixed", part => $part, }; } open(FILE, ">tmp.rfc822") or die "$!\n"; my $fh = *FILE; rfc822_output( filehandle => $fh, envelope => $envelope, body => $body, ); seek($fh, 0, 0); local $/ = undef; my $text = <$fh>; close(FILE); $smtp->close(); # Append the message to mailbox my $msg2mb = "postponed-msgs"; my $mailbox = "{mail.aeiou.pt/imap}mail/$msg2mb"; $cclient->append($mailbox, $text); exit(0); Mail-Cclient-1.12/examples/struct.txt0000644000076400007640000000163307540352704020256 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); set_callback log => sub { my ($str, $type) = @_; print "$type: $str\n"; }, dlog => sub { print "debug: $_[0]\n" }; sub addr { my $alist = shift; return join(", ", map { sprintf('%s@%s (%s)', $_->mailbox, $_->host, $_->personal) } @$alist); } if (@ARGV != 2) { print STDERR "Usage: struct.t mailstream msgno\n"; exit 2; } my $stream = shift; my $msgno = shift; $c = Mail::Cclient->new($stream) or die "can't open mailstream $stream\n"; ($env, $body) = $c->fetch_structure($msgno); printf "from %s\n", addr($env->from), printf "to %s\n", addr($env->to); printf "subject is %s\n", $env->subject; my $type = $body->type; printf "MIME type %s/%s\n", lc($type), lc($body->subtype); if ($type eq "MULTIPART") { my $part; foreach $part (@{$body->nested}) { printf "type of subpart: %s/%s\n", lc($part->type), lc($part->subtype); } } Mail-Cclient-1.12/examples/sort.txt0000644000076400007640000000205707362561722017726 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); # Criteria examples # # '12,23,45,16,19 SUBJECT "perl"' # 'FLAGGED SINCE 1-Feb-1994 NOT FROM "SMITH"' # 'ALL FROM "hdias" NOT SUBJECT "spam" NOT TEXT "bug"' # 'OR FROM "hdias" SUBJECT "perl"' # 'FROM "hdias" NOT FROM "smith" OR SUBJECT "perl" TO "cpan"' # 'FROM "hdias"' # 'ANSWERED TO "malcolm"' # my $criteria = "ALL FROM \"hdias\""; # first sort by "from" if two or more messages collate identically # in that case sort by "size" in the end sort by subject. my $sequence = $cclient->sort( SORT => ["from", 0, "size", 1, "subject", 0], SEARCH => $criteria); for(@{$sequence}) { print "$_\n"; } my @array = ("from", 0, "size", 1, "subject", 0); my $sequence = $cclient->sort( SORT => \@array, SEARCH => $criteria, FLAG => "uid"); my $sequence = $cclient->sort( SORT => ["subject", 1], SEARCH => $criteria, FLAG => ["uid"]); my $sequence = $cclient->sort( SORT => ["size", 0, "from", 1, "subject", 0], SEARCH => $criteria, FLAG => ["uid", "noprefetch"]); Mail-Cclient-1.12/examples/thread.txt0000644000076400007640000000073107320307255020174 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); my $thr = $cclient->thread( THREADING => "references", SEARCH => "ALL FROM \"hdias\"", FLAG => "uid"); # $thr = [214, [5, 12, 24], 144, 123, [5, [10, 8, 2]], 65] &loop($thr, ""); sub loop { my ($thr, $str) = @_; for(@{$thr}) { if(ref($_) eq "ARRAY") { &loop($_, $str . "--"); } else { print "$str> $_\n"; } } } 1; > 214 --> 5 --> 12 --> 24 > 144 > 123 --> 5 ----> 10 ----> 8 ----> 2 > 65 Mail-Cclient-1.12/examples/search.txt0000644000076400007640000000276107362561460020205 0ustar wwwadminweb00000000000000use Mail::Cclient qw(set_callback); # Criteria examples # # '12,23,45,16,19 SUBJECT "perl"' # 'FLAGGED SINCE 1-Feb-1994 NOT FROM "SMITH"' # 'ALL FROM "hdias" NOT SUBJECT "spam" NOT TEXT "bug"' # 'OR FROM "hdias" SUBJECT "perl"' # 'FROM "hdias" NOT FROM "smith" OR SUBJECT "perl" TO "cpan"' # 'FROM "hdias"' # 'ANSWERED TO "malcolm"' # --- Example 1 my @sequence = (); set_callback( 'searched' => sub { my ($stream, $number) = @_; push(@sequence, $number); } ); my $criteria = "ALL FROM \"hdias\""; $cclient->search( SEARCH => $criteria); # results via searched callback for(@sequence) { print "$_\n"; } --- Example 2 my @sequence = (); set_callback( 'searched' => sub { my ($stream, $number) = @_; push(@sequence, $number); } ); $cclient->search( SEARCH => "FLAGGED SINCE 1-Feb-1994 NOT FROM \"SMITH\"", FLAG => ["uid"]); # results via searched callback for(@sequence) { print "$_\n"; } --- Example 3 my @sequence = (); set_callback( 'searched' => sub { my ($stream, $number) = @_; push(@sequence, $number); } ); $cclient->search( SEARCH => "FROM \"hdias\"", FLAG => "uid"); # results via searched callback for(@sequence) { print "$_\n"; } --- Example 4 my @sequence = (); set_callback( 'searched' => sub { my ($stream, $number) = @_; push(@sequence, $number); } ); $cclient->search( SEARCH => "ANSWERED TO \"malcolm\"", FLAG => ["uid","noprefetch"]); # results via searched callback for(@sequence) { print "$_\n"; } Mail-Cclient-1.12/testmbx/0000755000076400007640000000000010132021657016025 5ustar wwwadminweb00000000000000Mail-Cclient-1.12/testmbx/multipart.mbox0000644000076400007640000001672210041012552020736 0ustar wwwadminweb00000000000000From hdias@aesbuc.pt Mon Apr 19 18:54:39 2004 Return-Path: Received: from rosa.esb.ucp.pt (rosa.esb.ucp.pt [192.168.2.6]) by rosa.esb.ucp.pt (8.12.8/8.12.8) with ESMTP id i3JHscVj017089 for ; Mon, 19 Apr 2004 18:54:38 +0100 Date: Mon, 19 Apr 2004 18:54:38 +0100 (WEST) From: Henrique Ribeiro Dias X-X-Sender: hdias@rosa.esb.ucp.pt To: wwwadmin@esb.ucp.pt Subject: Attached Mail Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-1463810558-1894019935-1082397278=:16856" X-Spam-Probability: 0% Status: RO X-Status: X-Keywords: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463810558-1894019935-1082397278=:16856 Content-Type: TEXT/PLAIN; charset=US-ASCII Attached Mail -- ------------------------------------------------ Henrique Manuel Ribeiro Dias Escola Superior de Biotecnologia - UCP Gabinete de Desenvolvimento de Software Rua Dr. Antonio Bernardino de Almeida 4200 Porto Portugal Tel: 351-225580092 CPAN: http://www.cpan.org/authors/id/H/HD/HDIAS/ ------------------------------------------------ ---1463810558-1894019935-1082397278=:16856 Return-Path: Received: from rosa.esb.ucp.pt (rosa.esb.ucp.pt [192.168.2.6]) by rosa.esb.ucp.pt (8.12.8/8.12.8) with ESMTP id i3JHn4Vj016361 for ; Mon, 19 Apr 2004 18:49:04 +0100 Date: Mon, 19 Apr 2004 18:49:04 +0100 (WEST) From: Henrique Ribeiro Dias X-X-Sender: hdias@rosa.esb.ucp.pt To: wwwadmin@esb.ucp.pt Subject: Attachments Test Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-1463810558-1197794565-1082396944=:14682" X-Spam-Probability: 0% Status: RO X-Status: X-Keywords: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463810558-1197794565-1082396944=:14682 Content-Type: TEXT/PLAIN; charset=US-ASCII Attachments Test -- ------------------------------------------------ Henrique Manuel Ribeiro Dias Escola Superior de Biotecnologia - UCP Gabinete de Desenvolvimento de Software Rua Dr. Antonio Bernardino de Almeida 4200 Porto Portugal Tel: 351-225580092 CPAN: http://www.cpan.org/authors/id/H/HD/HDIAS/ ------------------------------------------------ ---1463810558-1197794565-1082396944=:14682 Content-Type: IMAGE/gif; name="sm_camel.gif" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Camel Content-Disposition: attachment; filename="sm_camel.gif" R0lGODlhSQBOAKIAAA4ODjAwMExMTGtra6Kior29vc/Pz////yH5BAAAAAAA LAAAAABJAE4AAAP/eLrc/jASMUgxMWtH8P5EUASCEBBW8a3NEAAn+xivGwzF AFTD4ckaA28wMPyABRgOhRkIQicLcFHoUClFg2BXmW6fOUrHdsMZVEDaqYp6 Bc4EYuW40QXuL0BJ7xxe0nooFhgEADsmRABWKzQmMHqIT3FEN3AyBlYXhDl3 WRNEdBEwL45OJ3ImJQIFrGlyRj5nLpIhhgQfOoZ6hjZyPGIpaIx7oFUYrDaP AKENBrrPNzUUF4JxKVMKBVhzClCowg+Fz7wlTtNG1uat2AfagrCoJFIQuXuG WNvcmEtEi1POKLoUklMDAg1bFki58CVH0z5kT9jpsNHBDZEvD3LpybGv/wSe IYOMCBHjBByLe3MKkRjSo4USEzmqVClTotoFh/0mTckVcBKynAyc8RKiCMUF X0bPiFzKRtYtGbz6kDjawRqDPBUuUFCKyagmY0pjsTISkxkElX0mWMgJaoEd HIowETpmRuTNpT6+/mShg9Y+cxRidLsXJ+KfMz5AwWHlkGyHphPMOtCxVsVC GyV+vC1TN9stIT3LntFUNavOD4G2mkuEaMFBLNV8yOZ60Qxjr5hgW4gYBBKO Civ78D4grsyYpyLbaTJdrWfXChFRfKjBMeekpwq27Dgwp8vs0XZ/WrOmousN 4tgzdBrzJrcc10ObmlEAa+k8uUJ4dCAbIw6umv8TZeMEE/TxUgV0PWCQ3GxM HNPTO+gUQdx5GvRyx2hVbOVDG0rEcWFQscjGhhRyHRaLEIRomIFKpMSUwxxK aUNCPgp6gE55IiVlDH2zJTjQOmftwEuDglCjVSkwWGFXXsgxtlR9NQqR14AC ZOCMRUYRV0EKY8ySSxGfjablY16N9aQHkY2VSIX3THVLDnGowMokptwRhwcy 7WaBUbg59NlWfNohmRozPjVijYLYowgaxgxSFVgYhnRMJUxMAoN6UeFA2liJ HUhGXYJISBaoI0pnxBdblmXIoHlcd8yJcMYTxU0NnmhGokTIxAkkKST4QnoO JMEHDwvsN1JAbjTYR1b/9GW1pRyFkQBDTWwoIA+bK2XZzobCsSiAggMyRs0n y0Y7yrRbzkOCZK5tcVEKxzgyrSF3qDDBVqTdQG0889K7ihMLJPlBEjdUc6ou qmhXlBbkHZODEhdpdwK9nbwYMAUrDHSRZShh5oYkdY0VU3B4iOHRHh18u0Bm LOAxlMR5pPJxwU8lmttjYxUyhiMJMUDZFMKaodFLedDbTxN87jcnKdmZ8EYI DCTRUhpHUNyhhxtJYuZ1Cq+qgAuGzMSAzuw0UENAesBBUhRgNDGOIsUStF3A y5R9ldE/FxvYE621M84bVHQ3t9/Alu1G0Uc4wYWHKgv7CLALjVCltSrbnY2/ /+I08MiMKxX4jEkhzDR15ZYTJ6Qed0T9DBZ1+z1KAMFSQG+xpRc7oy5Tc9dv CFOrwYcDQpVhY+2XSxu2z22i/gPvdmYkD+nE+zCtG2bf4REJUZ9QEPCIiBA9 fOce4YzTieTuTCKFfy1t+pYLNUoDW9yxwwvg0KA4+1cCYFLt43s4NiQuk5Br oqC/CCiOXewYH8P+B5y8BUUEIZCMHb4Hn4mBoy3nAJ7+/COBwVFQCa3LTku8 wwGh7a9YeqCgW/hmtgL6owFw0sYJv+Y1FWZlcihMEI8UlBgl7RB+JVEhDWYi vi18ZjazeQIPl5hEq1DQGUT8IWWYeIzkUJGHPEAg8P/OhBcFDCtE9oHbk2TI RSsaoQ+XMCMY6yO/xkQpgjXizn7WeKIaeTAIZXxSLMSQxwgxJQt9fJL3PhBI Lt7AjVyEEWgK+SRNaZE+jDzDVhi5CrtEUiR1WZCVyCKuTmbIk6BkjAjCE0pQ FqExf9gAJz2Zn1Kachkic6W4ksKUGUYgjkZYgyyd5K6HsFJEjHGkgjhlNy2A 8gcYOpA4stJJOoxmFYgsHTNxEzVd8Y5ci5lHUHw5vNKVKBjiE5ci6pKkTp7F K98jZSrpwwqFdKJpaxjEDDBBTOJ9Zk4mEQkFVLYIcWgiAqhcp904Ap5BwQKS YanDNnZAAwyEUAZVkSchocQ3iFlUxAcQBABE8eCkRxruXEWoEsMqwYgZfasQ tgTRLTPAiQuhKD8YS2OMPFq2YbqxjirM6QcSAAA7 ---1463810558-1197794565-1082396944=:14682 Content-Type: TEXT/plain; name="test_three.txt" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Three Content-Disposition: attachment; filename="test_three.txt" dGhyZWUNCg== ---1463810558-1197794565-1082396944=:14682 Content-Type: TEXT/plain; name="test_two.txt" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Two Content-Disposition: attachment; filename="test_two.txt" dHdvDQo= ---1463810558-1197794565-1082396944=:14682 Content-Type: TEXT/plain; name="test_one.txt" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: One Content-Disposition: attachment; filename="test_one.txt" dGVzdF9vbmUNCg== ---1463810558-1197794565-1082396944=:14682-- ---1463810558-1894019935-1082397278=:16856 Content-Type: IMAGE/gif; name="poweredby_perl.gif" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Powered Content-Disposition: attachment; filename="poweredby_perl.gif" R0lGODlhWAAfALMAAAAAAP///2BplzNjjJChrG5zdhZqmwBmmQZeikGMssPP 1QBCYQFWf4nZ/wIiMD5FRywAAAAAWAAfAAAE/3DJSau9OOvNd2hgKI5kaZ5o qpKMszBILM90bd94rttDbzMLF+xALBqPyKRyyUQaBAOnQBEIEAxHoBBxSCi+ CSIhoEh4wwrCgVD+pg9utRc8Lx/jcMVagR0IxgoCRgNUVVVqRlovXAkBBVQL VIAMjo0KC1YFjg8PmGwBhAGcD2OPCgxFBlZUA6VWDlOGZFhEhbJ8iUGLawEA Xw+OAGMOjlQKmg5jABKNpL1fy5EKwgEORc3QA1XTC5+yggcCsrIFuVtwhgWa y9BfVmQEvoYGY1UDAIZ6r8pF9Y7WVRxYMxDK0AN6427ROqBoCJkHAKgBQGBF HgFg1TBNi0hF0wNtBf8iAitAbFoRKr4u5QGA6kDBh/4SHirSEIEqkgsQlKIi cJgnAKouolEwslGBAWYcjXlgrRbRVwegirmlSeatKAx1wWi2gIgBYyEZJIhH SWCjbZhIKjVEoJ6Cey2jbjP7rx+5qlbTEal5YMGyIggcROzatynLvhEBWPsb LbGLiA7iEnHMhcHfqfls5SUThW+Tz6BDKxG3OS8fz0rMqF7YRbVqIq4TsH4t 2qXm0vkCCECd5DYuueO6+g4j91TtcLjHET3GG0khd2S4ZIaGjsxzVHOPH8Bb 2tgD5lq5LCmkuNCD4ooFWiOfrMr57Nq/p8l78SH4c+OrAOAlihKZpifpx9// A/4pAOBxIrlXVQGlOPAFg5GFxwR5X+mHyUO0mXcWN/Bpd4ADVT0QokfdODJA hPgpcVtFFCmHim8QFXegduIYaAw15xFSAAIMNHcHVYoBF8d622xzWIcegoRP MKUcQM+OWaXYm36JEWakekT2Us95MnpYBEglKcbGQF9g4aMR5CGBZHUAnEUA dv95SQRI4RD1VUhOplGZhPn1omacaAqY3ZrHicOlKQQE4eRFXZ0ZoJ9HyISG gOYBJwtxtf0x0QEIaEJAU/QQGOUufe4XaUKdpOmmf+N0Umg8RMTiyJxE7cXn EoKZekRivHaVKxF+BclrlbV9lagYBKjDpThXjDqEQpzQehhLAYRh8Wud5Tjb 47bcduvtt+CGK664AxQggBA9StDtPS801MG78MaLgWAcuDCBC1jmq+++/Pbr 778AByxQBAA7 ---1463810558-1894019935-1082397278=:16856-- Mail-Cclient-1.12/testmbx/test.mbox0000644000076400007640000035414307461501024017707 0ustar wwwadminweb00000000000000From ahu@home.ds9a.nl Sat Oct 7 23:29:30 2000 Return-Path: Delivered-To: lartc@outpost.ds9a.nl Received: from home.ds9a.nl (3dyn35.com21.casema.net [212.64.94.35]) by outpost.ds9a.nl (Postfix) with SMTP id 70B887504B for ; Sat, 7 Oct 2000 23:29:30 +0200 (CEST) Received: (qmail 4779 invoked by uid 500); 7 Oct 2000 22:24:03 -0000 Date: Sun, 8 Oct 2000 00:24:03 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Message-ID: <20001008002403.B4733@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i Subject: [LARTC] testing Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-IMAPbase: 1005784835 1666 Status: RO X-Status: X-Keywords: X-UID: 1 testing -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From ahu@home.ds9a.nl Sat Oct 7 23:32:22 2000 Return-Path: Delivered-To: lartc@outpost.ds9a.nl Received: from home.ds9a.nl (3dyn35.com21.casema.net [212.64.94.35]) by outpost.ds9a.nl (Postfix) with SMTP id 0FC3A7504B for ; Sat, 7 Oct 2000 23:32:22 +0200 (CEST) Received: (qmail 4795 invoked by uid 500); 7 Oct 2000 22:26:55 -0000 Date: Sun, 8 Oct 2000 00:26:55 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] testing Message-ID: <20001008002655.A4787@home.ds9a.nl> References: <20001008002403.B4733@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <20001008002403.B4733@home.ds9a.nl>; from ahu@ds9a.nl on Sun, Oct 08, 2000 at 12:24:03AM +0200 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ Status: RO X-Status: X-Keywords: X-UID: 2 On Sun, Oct 08, 2000 at 12:24:03AM +0200, bert hubert wrote: > testing > > -- > PowerDNS Versatile DNS Services > Trilab The Technology People > 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet > > > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/mailman/listinfo/lartc > en nu? -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From ahu@home.ds9a.nl Sat Oct 7 23:34:52 2000 Return-Path: Delivered-To: lartc@outpost.ds9a.nl Received: from home.ds9a.nl (3dyn35.com21.casema.net [212.64.94.35]) by outpost.ds9a.nl (Postfix) with SMTP id 944DC7504B for ; Sat, 7 Oct 2000 23:34:52 +0200 (CEST) Received: (qmail 4820 invoked by uid 500); 7 Oct 2000 22:29:26 -0000 Date: Sun, 8 Oct 2000 00:29:26 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] testing Message-ID: <20001008002925.B4787@home.ds9a.nl> References: <20001008002403.B4733@home.ds9a.nl> <20001008002655.A4787@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <20001008002655.A4787@home.ds9a.nl>; from ahu@ds9a.nl on Sun, Oct 08, 2000 at 12:26:55AM +0200 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ Status: RO X-Status: X-Keywords: X-UID: 3 -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From ahu@home.ds9a.nl Sat Oct 7 23:56:40 2000 Return-Path: Delivered-To: lartc@outpost.ds9a.nl Received: from home.ds9a.nl (3dyn35.com21.casema.net [212.64.94.35]) by outpost.ds9a.nl (Postfix) with SMTP id 0E0327504B for ; Sat, 7 Oct 2000 23:56:39 +0200 (CEST) Received: (qmail 4915 invoked by uid 500); 7 Oct 2000 22:51:13 -0000 Date: Sun, 8 Oct 2000 00:51:12 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Message-ID: <20001008005112.A4909@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i Subject: [LARTC] testing Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ Status: RO X-Status: X-Keywords: X-UID: 4 boe -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From sibon@triple-it.nl Fri Oct 27 23:37:09 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from www.triple-it.nl (quake.multiweb.nl [195.114.255.130]) by outpost.ds9a.nl (Postfix) with ESMTP id F02B17504B for ; Fri, 27 Oct 2000 23:37:08 +0200 (CEST) Received: from www.triple-it.nl (sibon@www.triple-it.nl [195.114.255.130]) by www.triple-it.nl (8.9.3/8.9.3) with ESMTP id XAA30166 for ; Fri, 27 Oct 2000 23:37:02 +0200 Date: Fri, 27 Oct 2000 23:37:02 +0200 (CEST) From: Clemens Sibon To: lartc@mailman.ds9a.nl Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [LARTC] ingress still not working :-( Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 104 Status: RO Content-Length: 497 Lines: 19 Hi there, I am still having troubles getting ingress policy shaping to work. I run 2.2.16-3 kernel with all QoS options enabled (and in the kernel, not as modules), installed iproute.2.2.4-2 from RPM (running Red Hat here). Shaping in the 'other direction' is working by the way. I try the following (as found in multiple documents): tc qdisc add dev eth0 handle ffff: ingress The error I get is: RTNETLINK answers: No such file or directory Any help is greatly appreciated, Clemens Sibon From revans@ozarkaircraftsystems.com Fri Oct 27 23:51:20 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from stargate.ozarkaircraftsystems.com (fwall.ozarkaircraftsystems.com [12.10.100.210]) by outpost.ds9a.nl (Postfix) with ESMTP id 0F1BE7504B for ; Fri, 27 Oct 2000 23:51:19 +0200 (CEST) Received: from localhost (revans@localhost) by stargate.ozarkaircraftsystems.com (8.9.3/8.9.3) with ESMTP id QAA28924 for ; Fri, 27 Oct 2000 16:51:15 -0500 Date: Fri, 27 Oct 2000 16:51:15 -0500 (CDT) From: To: lartc@mailman.ds9a.nl In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [LARTC] tc filters Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 105 Status: O Content-Length: 156 Lines: 7 Is it possible to specify a "NOT" in a tc filter src or dst address? In ipchains a simple "!" does it, but that does not seem to work with tc. Thanks. From s940195@student.ulg.ac.be Sat Oct 28 10:17:15 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from darkstalker.darkness.be (212-100-178-65.adsl.easynet.be [212.100.178.65]) by outpost.ds9a.nl (Postfix) with ESMTP id 7B5B37504B for ; Sat, 28 Oct 2000 10:17:14 +0200 (CEST) Received: from student.ulg.ac.be (localhost [127.0.0.1]) by darkstalker.darkness.be (8.10.1/8.10.1) with ESMTP id e9S8H9v17896 for ; Sat, 28 Oct 2000 10:17:13 +0200 Message-ID: <39FA8B84.8CF1DF80@student.ulg.ac.be> Date: Sat, 28 Oct 2000 10:17:08 +0200 From: Raffaele Brancaleoni Organization: =?iso-8859-1?Q?Universit=E9?= de =?iso-8859-1?Q?Li=E8ge?= X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17 i686) X-Accept-Language: en MIME-Version: 1.0 To: lartc@mailman.ds9a.nl References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: [LARTC] Limits of CBQ process under Linux Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 106 Status: O Content-Length: 1015 Lines: 35 Hi!, I'm in the process of building a load generator to stress test some networking equipment for my thesis and I'm wondering how Linux would support doing egress traffic shaping with on several hundreds(!) virtual ip's defined on the machine doing the QoS itself. I have to limit the transmission rate for each virtual ip at, let say, 300Kbit output rate. I currently use CBQ with SFQ queue policy and get good behaviour from the setup but I only use <10 virtual ip's for now. ( This implies 10 different classes in CBQ process) I would like to know if anyone have experience with this kind of setup or if anyone does know the limits of the CBQ process with Linux kernels. Thanks for your help, Raffaele -- _______________________________________________________________________________ Raffaele Brancaleoni Email : s940195@student.ulg.ac.be Licence en Informatique Université de Liège - Belgium _______________________________________________________________________________ From ahu@home.ds9a.nl Sat Oct 28 14:03:23 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (3dyn109.com21.casema.net [212.64.94.109]) by outpost.ds9a.nl (Postfix) with SMTP id D25887504B for ; Sat, 28 Oct 2000 14:03:19 +0200 (CEST) Received: (qmail 4058 invoked by uid 500); 28 Oct 2000 12:57:32 -0000 Date: Sat, 28 Oct 2000 14:57:32 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] ingress still not working :-( Message-ID: <20001028145731.A4047@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: ; from sibon@triple-it.nl on Fri, Oct 27, 2000 at 11:37:02PM +0200 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 108 Status: O Content-Length: 550 Lines: 20 On Fri, Oct 27, 2000 at 11:37:02PM +0200, Clemens Sibon wrote: > I try the following (as found in multiple documents): > tc qdisc add dev eth0 handle ffff: ingress > > The error I get is: > RTNETLINK answers: No such file or directory This is a known issue. I try to find the people who wrote the ingress policer. I'll also put a note in the HOWTO. Regards, bert hubert -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From sibon@triple-it.nl Sat Oct 28 15:25:54 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from www.triple-it.nl (quake.multiweb.nl [195.114.255.130]) by outpost.ds9a.nl (Postfix) with ESMTP id 529447504B for ; Sat, 28 Oct 2000 15:25:54 +0200 (CEST) Received: from www.triple-it.nl (sibon@www.triple-it.nl [195.114.255.130]) by www.triple-it.nl (8.9.3/8.9.3) with ESMTP id PAA01151 for ; Sat, 28 Oct 2000 15:25:51 +0200 Date: Sat, 28 Oct 2000 15:25:51 +0200 (CEST) From: Clemens Sibon To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] ingress still not working :-( In-Reply-To: <20001028145731.A4047@home.ds9a.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 109 Status: O Content-Length: 926 Lines: 28 On Sat, 28 Oct 2000, bert hubert wrote: > On Fri, Oct 27, 2000 at 11:37:02PM +0200, Clemens Sibon wrote: > > > The error I get is: > > RTNETLINK answers: No such file or directory > > This is a known issue. I try to find the people who wrote the ingress > policer. I'll also put a note in the HOWTO. When I read the help in the kernel-menu, I saw something under Kernel/User netlink socket (CONFIG_NETLINK) about a device that should be made having major mode 36. Could this be the thing missing that generates the above error? I have no idea how to find out if I have the device or how to make it, since the name isn't mentioned anywhere. I have been looking for a /dev/ingress but that doesn't exist.. Do I have to upgrade to a 2.4.X kernel to get ingress policer to work without the errors? If that's the case, I am willing to give it a try (and probably I should convert my ipchains to iptables?) Clemens Sibon From ahu@home.ds9a.nl Sat Oct 28 15:54:38 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (3dyn109.com21.casema.net [212.64.94.109]) by outpost.ds9a.nl (Postfix) with SMTP id B9AB37504B for ; Sat, 28 Oct 2000 15:54:37 +0200 (CEST) Received: (qmail 4229 invoked by uid 500); 28 Oct 2000 14:48:43 -0000 Date: Sat, 28 Oct 2000 16:48:43 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] ingress still not working :-( Message-ID: <20001028164843.B4047@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: <20001028145731.A4047@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: ; from sibon@triple-it.nl on Sat, Oct 28, 2000 at 03:25:51PM +0200 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 110 Status: O Content-Length: 947 Lines: 29 On Sat, Oct 28, 2000 at 03:25:51PM +0200, Clemens Sibon wrote: > When I read the help in the kernel-menu, I saw something under Kernel/User > netlink socket (CONFIG_NETLINK) about a device that should be made having > major mode 36. Could this be the thing missing that generates the above > error? No, that's not it. > I have been looking for a /dev/ingress but that doesn't exist.. And it shouldn't - these filters have no corresponding entries in /dev. > Do I have to upgrade to a 2.4.X kernel to get ingress policer to work > without the errors? If that's the case, I am willing to give it a try > (and probably I should convert my ipchains to iptables?) It doesn't work in 2.4 either. I'll post some mail about this problem here shortly. Regards, bert hubert -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From ahu@home.ds9a.nl Sat Oct 28 16:57:24 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (3dyn109.com21.casema.net [212.64.94.109]) by outpost.ds9a.nl (Postfix) with SMTP id 010B27504B for ; Sat, 28 Oct 2000 16:57:23 +0200 (CEST) Received: (qmail 4441 invoked by uid 500); 28 Oct 2000 15:51:23 -0000 Date: Sat, 28 Oct 2000 17:51:23 +0200 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] Limits of CBQ process under Linux Message-ID: <20001028175122.A4433@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: <39FA8B84.8CF1DF80@student.ulg.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <39FA8B84.8CF1DF80@student.ulg.ac.be>; from s940195@student.ulg.ac.be on Sat, Oct 28, 2000 at 10:17:08AM +0200 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 111 Status: O Content-Length: 912 Lines: 24 On Sat, Oct 28, 2000 at 10:17:08AM +0200, Raffaele Brancaleoni wrote: > Hi!, > I'm in the process of building a load generator to stress test some networking > equipment for my thesis and I'm wondering how Linux would support doing > egress traffic shaping with on several hundreds(!) virtual ip's defined on > the machine doing the QoS itself. You should probably ask this on netdev (netdev@oss.sgi.com). However, I've seen the code and I know the quality of Jamal and Alexeys work, I would suspect that Linux will not ever be your bottleneck. Lots of places use hashtables to speed up processing. I got mail from a guy who did really incredible things with Linux and shaping, also with hundreds of interfaces. Regards, bert hubert -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From rzm@icm.edu.pl Wed Nov 1 02:31:13 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from atol.icm.edu.pl (atol.icm.edu.pl [212.87.0.35]) by outpost.ds9a.nl (Postfix) with ESMTP id 0846A7504B for ; Wed, 1 Nov 2000 02:31:12 +0100 (CET) Received: from burza.icm.edu.pl ([148.81.208.198]:12183 "EHLO burza.icm.edu.pl" ident: "IDENT-NONSENSE") by atol.icm.edu.pl with ESMTP id ; Wed, 1 Nov 2000 02:29:35 +0100 Received: (from rzm@localhost) by burza.icm.edu.pl (8.9.3/8.9.3/rzm-2.6/icm) id CAA07690 for lartc@mailman.ds9a.nl; Wed, 1 Nov 2000 02:28:13 +0100 (MET) Date: Wed, 1 Nov 2000 02:28:13 +0100 From: Rafal Maszkowski To: lartc@mailman.ds9a.nl Message-ID: <20001101022813.A7199@burza.icm.edu.pl> References: <39FA8B84.8CF1DF80@student.ulg.ac.be> <20001028175122.A4433@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.1i In-Reply-To: <20001028175122.A4433@home.ds9a.nl>; from ahu@ds9a.nl on Sat, Oct 28, 2000 at 05:51:23PM +0200 Subject: [LARTC] how many u32 filters? Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 121 Status: O Content-Length: 1442 Lines: 37 I asked already on netdev. Maybe my description is too obscure? Could you try to answer or help me to make the question clearer? I am adding u32 filters with commands like: tc filter add dev eth0 parent 10:0 protocol ip prio 100 handle 800::2 u32 match ip dst 10.30.40.3 flowid 10:2 ... getting: filter parent 10: protocol ip pref 100 u32 filter parent 10: protocol ip pref 100 u32 fh 800: ht divisor 1 filter parent 10: protocol ip pref 100 u32 fh 800::2 order 2 key ht 800 bkt 0 flowid 10:2 match 0a1e2803/ffffffff at 16 filter parent 10: protocol ip pref 100 u32 fh 800::3 order 3 key ht 800 bkt 0 flowid 10:3 match 0a1e2809/ffffffff at 16 ... and then I can delete them with tc filter del dev eth0 parent 10:0 protocol ip prio 100 handle 800::2 u32 match ip dst 10.30.40.3 flowid 10:2 It looks like the highest handle is 800::7ff (or maybe fff) and there may be only 2048 (4k?) filters with unique handles. They have to be unique to make single filters deletions possible. Is it possible to setup the u32 filters in such a way that 64k or more unique handles would be available? I do not know if a single system would be able to carry such load but maybe it is possible, I hope to be able to test it in the future. A company I work for in principle may need tens of thousands of limits, putting every 2k of limits on a separate machine would be limiting us to much. R. -- W iskier krzesaniu ¿ywem/Materia³ to rzecz g³ówna From ahu@home.ds9a.nl Sun Nov 5 22:01:26 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (3dyn134.com21.casema.net [212.64.94.134]) by outpost.ds9a.nl (Postfix) with SMTP id C192A7504B for ; Sun, 5 Nov 2000 22:01:25 +0100 (CET) Received: (qmail 18132 invoked by uid 500); 5 Nov 2000 21:55:23 -0000 Date: Sun, 5 Nov 2000 22:55:23 +0100 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] how many u32 filters? Message-ID: <20001105225523.B18069@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: <39FA8B84.8CF1DF80@student.ulg.ac.be> <20001028175122.A4433@home.ds9a.nl> <20001101022813.A7199@burza.icm.edu.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <20001101022813.A7199@burza.icm.edu.pl>; from rzm@icm.edu.pl on Wed, Nov 01, 2000 at 02:28:13AM +0100 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 139 Status: O Content-Length: 532 Lines: 16 On Wed, Nov 01, 2000 at 02:28:13AM +0100, Rafal Maszkowski wrote: > I asked already on netdev. Maybe my description is too obscure? Could you try > to answer or help me to make the question clearer? Ask the diffserv list, that's where jamal and alexey hang out, they may know. Google for the diffserv address (http://www.google.com) Regards, bert hubert -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From andrewd@uccsda.org Tue Nov 14 13:46:08 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from uccs3.uccsda.org (unknown [204.76.174.2]) by outpost.ds9a.nl (Postfix) with ESMTP id 03F4E7504C for ; Tue, 14 Nov 2000 13:46:07 +0100 (CET) Received: from ORION by uccs3.uccsda.org with SMTP (Microsoft Exchange Internet Mail Service Version 5.0.1458.49) id WMLKAH2V; Mon, 13 Nov 2000 14:52:53 -0800 Message-ID: <3A107206.1C5303AC@uccsda.org> Date: Mon, 13 Nov 2000 14:58:14 -0800 From: Andrew X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17smp.1 i686) X-Accept-Language: en MIME-Version: 1.0 To: lartc@mailman.ds9a.nl Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [LARTC] A complicated routing scenario (for me at least) Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 159 Status: RO Content-Length: 2876 Lines: 66 Greetings: I've been pouring over every piece of documentaiton on the subject I can find, and I've concluded that advanced routing + ipchains is what I need. It also appears that the people that can answer some of the more in depth questions I have, read this list. I'm fairly new to this so please forgive me if I ask stupid questions. Anyway. Here is what I'm trying to accomplish in ASCII art: LAN | (172...) | _/\__/\_ +---+----+ _/\__/\_ / \ (63...) | | (204...) / \ ( Internet )-----------+ Router +----------( Internet ) \_ __ _/ | | \_ __ _/ \/ \/ +----+---+ \/ \/ | 63.. | 204.. | --+---------------+----------+-- <---single physical net | | (i.e. one hub) | | +---+---+ 63..1 +---+---+ 63..2 | Linux | 63..4 | Linux | 63..3 +-------+ 204..1 +-------+ 204..2 204..4 204..3 The desired end result is a redundant connection to two dns/mail servers from the internet. I'm willing to fight through this, but I have a few specific question's for now that I'm hoping someone can answer. 1. From a server's perspective, do incoming packets get responded to on the same interface they came in on? Does it matter if the interface in question is an alias? 2. if I tag a packet coming into the router/firwall above with ipchains for routing purposes, will the tag persist to the reply packets? Or do I have to tag the reply packets with ipchains from the responding server? 3. In reading the various documentation, I noticed several references to files in the /etc/iproute2 directory. Related to this directory: a) is there any documentation on the names and syntax of the various files other than the source code, and the casual references I've found? b) I don't currently have this directory in /etc. Is it something I just create, and does it's existance imply that the kernel will read configureation data from it on boot? Incidentally I'm currently using kernel 2.2.17 on my boxes. Since I'm already going to be meticulously documenting my setup, I'd be willing to do so in a format that could be posted as a HOWTO or as an example in someone else's HOWTO, whatever would be most usefull. Suggestions in this area are much appreciated since I have no experiance in HOWTO writing. (Plenty of writing experiance, just not howtos) Anyway, Thanks for the help. -Andrew From arthurvl@sci.kun.nl Tue Nov 14 15:34:43 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from wn1.sci.kun.nl (wn1.sci.kun.nl [131.174.8.1]) by outpost.ds9a.nl (Postfix) with ESMTP id 4CA127504B for ; Tue, 14 Nov 2000 15:34:43 +0100 (CET) Received: from studs3.sci.kun.nl by wn1.sci.kun.nl via studs3.sci.kun.nl [131.174.124.4] with ESMTP id PAA04514 (8.8.8/3.30); Tue, 14 Nov 2000 15:34:28 +0100 (MET) Date: Tue, 14 Nov 2000 15:34:36 +0100 (MET) From: Arthur van Leeuwen To: Andrew Cc: lartc@mailman.ds9a.nl Subject: Re: [LARTC] A complicated routing scenario (for me at least) In-Reply-To: <3A107206.1C5303AC@uccsda.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 160 Status: O Content-Length: 4683 Lines: 112 On Mon, 13 Nov 2000, Andrew wrote: > Greetings: > I've been pouring over every piece of documentaiton on the subject I can > find, and I've concluded that advanced routing + ipchains is what I > need. It also appears that the people that can answer some of the more > in depth questions I have, read this list. Might be true, might be true. ;) > I'm fairly new to this so please forgive me if I ask stupid questions. > Anyway. We're all fairly new to this. It isn't older than a year or two, three at the most. > Here is what I'm trying to accomplish in ASCII art: > LAN > | (172...) > | > _/\__/\_ +---+----+ _/\__/\_ > / \ (63...) | | (204...) / \ > ( Internet )-----------+ Router +----------( Internet ) > \_ __ _/ | | \_ __ _/ > \/ \/ +----+---+ \/ \/ > | 63.. > | 204.. > | > --+---------------+----------+-- <---single physical > net > | | (i.e. one hub) > | | > +---+---+ 63..1 +---+---+ 63..2 > | Linux | 63..4 | Linux | 63..3 > +-------+ 204..1 +-------+ 204..2 > 204..4 204..3 Hmmm. Right. > The desired end result is a redundant connection to two dns/mail servers > from the internet. I'm willing to fight through this, but I have a > few specific question's for now that I'm hoping someone can answer. > 1. From a server's perspective, do incoming packets get responded to on > the same interface they came in on? No, unfortunately not. In fact, unless you specifically set things up so that it will go right the kernel will even play haywire with which interface packets with certain IP addresses are routed out. > Does it matter if the interface in > question is an alias? No. By the way, drop the mental concept of alias. With the iproute2 ip tool it only serves to confuse matters. Interfaces kan have multiple IP addresses attached to them. This is *much* more portable to IPv6... :) > 2. if I tag a packet coming into the router/firwall above with ipchains > for routing purposes, will the tag persist to the reply packets? No. > Or do I have to tag the reply packets with ipchains from the responding > server? Yes. > 3. In reading the various documentation, I noticed several references to > files in the /etc/iproute2 directory. Related to this directory: > a) is there any documentation on the names and syntax of the various > files other than the source code, and the casual references I've found? > b) I don't currently have this directory in /etc. Is it something I > just create, and does it's existance imply that the kernel will read > configureation data from it on boot? a. There are examples for these files in /usr/doc/iproute-2.2.4/iproute2/ on RedHat 6.2 systems with iproute2 installed and in /usr/share/doc/iproute-2.2.4/iproute2/ on RedHat 7.0 systems. These files all have names starting with rt_, and should also be in the iproute2 tarball, but I'm too lazy to check :). b. The directory can contain the files rt_dsfield, rt_protos, rt_realms, rt_scopes and rt_tables. Most of the values in these files are user settable, and will be read when the files exist. If they do not exist you do not get nice names and have to deal with the raw numbers. Note: they are *not* necessary for operation, just useful from a user's point of view. > Incidentally I'm currently using kernel 2.2.17 on my boxes. Since I'm > already going to be meticulously documenting my setup, I'd be willing to > do so in a format that could be posted as a HOWTO or as an example in > someone else's HOWTO, whatever would be most usefull. > Suggestions in this area are much appreciated since I have no experiance > in HOWTO writing. (Plenty of writing experiance, just not howtos) Well, an ASCII-gram such as the one above and step by step explanations of your setup and *why* you've taken those steps would be great. ;) > Anyway, Thanks for the help. No problem. Doei, Arthur. -- /\ / | arthurvl@sci.kun.nl | Work like you don't need the money /__\ / | A friend is someone with whom | Love like you have never been hurt / \/__ | you can dare to be yourself | Dance like there's nobody watching From s965817@uia.ua.ac.be Tue Nov 14 15:44:11 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from gems.uia.ac.be (hgems.uia.ac.be [143.169.254.10]) by outpost.ds9a.nl (Postfix) with ESMTP id 69F8E7504B for ; Tue, 14 Nov 2000 15:44:11 +0100 (CET) Received: from localhost (s965817@localhost) by gems.uia.ac.be (8.11.0/8.11.0) with ESMTP id eAEEi9V03777 for ; Tue, 14 Nov 2000 15:44:09 +0100 (MET) Date: Tue, 14 Nov 2000 15:44:09 +0100 (MET) From: "Wingtung.Leung" X-Sender: Cc: Linux Advanced Router & Traffic Control Subject: Re: [LARTC] A complicated routing scenario (for me at least) In-Reply-To: <3A107206.1C5303AC@uccsda.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 161 Status: O Content-Length: 1140 Lines: 31 On Mon, 13 Nov 2000, Andrew wrote: > 2. if I tag a packet coming into the router/firwall above with ipchains > for routing purposes, will the tag persist to the reply packets? Or do I > have to tag the reply packets with ipchains from the responding server? You'll have to tag them whenever they enter your gateway. The reply packets are just packets, at ip level there is no difference between them. Only the very first packets, which initiate the connection, carry some extra flags. > 3. In reading the various documentation, I noticed several references to > files in the /etc/iproute2 directory. Related to this directory: > b) I don't currently have this directory in /etc. Is it something I > just create, and does it's existance imply that the kernel will read > configureation data from it on boot? I believe you can just create that directory and the files. > Suggestions in this area are much appreciated since I have no experiance > in HOWTO writing. (Plenty of writing experiance, just not howtos) There is an HOWTO about writing HOWTO's, I think. Try http://www.linuxdoc.org/ for more elaborate info. Salukes, Tung From andrewd@uccsda.org Tue Nov 14 21:11:52 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from uccs3.uccsda.org (unknown [204.76.174.2]) by outpost.ds9a.nl (Postfix) with ESMTP id 6857D7504B for ; Tue, 14 Nov 2000 21:11:51 +0100 (CET) Received: from ORION by uccs3.uccsda.org with SMTP (Microsoft Exchange Internet Mail Service Version 5.0.1458.49) id WMLKA2HN; Tue, 14 Nov 2000 12:10:27 -0800 Message-ID: <3A119D73.E5F9D7E8@uccsda.org> Date: Tue, 14 Nov 2000 12:15:47 -0800 From: Andrew X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17smp.1 i686) X-Accept-Language: en MIME-Version: 1.0 To: lartc@mailman.ds9a.nl Cc: arthurvl@sci.kun.nl Subject: Re: [LARTC] A complicated routing scenario (for me at least) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 162 Status: O Content-Length: 3281 Lines: 69 Thanks for the reply, Here are a few more questions > > LAN > > | (172...) > > | (eth1) > > _/\__/\_ +---+----+ _/\__/\_ > > / \ (63...) | | (204...) / \ > > ( Internet )-----------+ Router +----------( Internet ) > > \_ __ _/ (eth0) | | (eth2) \_ __ _/ > > \/ \/ +----+---+ \/ \/ > > (eth3)| 63.. > > | 204.. > > | > > --+---------------+----------+-- <---single physical > > net > > | | (i.e. one hub) > > | | > > +---+---+ 63..1 +---+---+ 63..2 > > | Linux | 63..4 | Linux | 63..3 > > +-------+ 204..1 +-------+ 204..2 > > 204..4 204..3 > a. There are examples for these files in /usr/doc/iproute-2.2.4/iproute2/ on > RedHat 6.2 systems with iproute2 installed and in > /usr/share/doc/iproute-2.2.4/iproute2/ on RedHat 7.0 systems. > These files all have names starting with rt_, and should also be in > the iproute2 tarball, but I'm too lazy to check :). > b. The directory can contain the files rt_dsfield, rt_protos, rt_realms, > rt_scopes and rt_tables. Most of the values in these files are user > settable, and will be read when the files exist. If they do not exist you > do not get nice names and have to deal with the raw numbers. Note: they > are *not* necessary for operation, just useful from a user's point of > view. OK.. someplace else to look. Are the examples the only thing available in the way of file syntax? Also could someone help me understand how these files are read at startup if they exist. (what code/script is responsible for doing it, and what happens if there are syntax errors. I have a redhat 6.2 system.) > Well, an ASCII-gram such as the one above and step by step explanations of > your setup and *why* you've taken those steps would be great. ;) If/When I get this written up, is this mailing list the place to post it? Would there be any value in puting it into a separate (mini)-HOWTO? Based on what everyone's said, here is what I'm contemplating (this still assumes that that packets are answered on the same interface they come in on. I'm getting conflicting information for this. Someone said they do, and someone else said they don't. I suppose if they don't I could use an explicit source address hint in a routing table entry.): Packets coming in on eth0,1, and 2 would be marked with different TOS values based on what interface they came in on using ipchains, and routed through the proper address on eth3 using the advanced routing. Since the TOS field doesn't change (an assumption, is this true?) I would know which interface to route the packet back through while at the same time being able to reset the TOS field back to zero for routing on the internet. Comments? Suggestions? Thanks, -Andrew depaan@bibleinfo.com From whit@transpect.com Tue Nov 14 22:47:46 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from transpect.com (china.patternbook.com [216.254.75.60]) by outpost.ds9a.nl (Postfix) with ESMTP id 23BDB7504B for ; Tue, 14 Nov 2000 22:47:39 +0100 (CET) Received: (from root@localhost) by transpect.com (8.9.3/8.8.7) id QAA01674; Tue, 14 Nov 2000 16:47:28 -0500 Date: Tue, 14 Nov 2000 16:47:28 -0500 From: Whit To: Andrew Cc: lartc@mailman.ds9a.nl Subject: Re: [LARTC] A complicated routing scenario (for me at least) Message-ID: <20001114164728.B1644@www.transpect.com> References: <3A119D73.E5F9D7E8@uccsda.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3A119D73.E5F9D7E8@uccsda.org>; from andrewd@uccsda.org on Tue, Nov 14, 2000 at 12:15:47PM -0800 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 163 Status: O Content-Length: 724 Lines: 18 Andrew, I'm awfully glad you're asking these questions, since I'm contemplating a similar setup and am not yet to that wonderful place where this presently obscure new technology resolves into clarity. So I'll be trying to follow along closely as you work out your scheme. One question I have, in addition to those you're asking, is whether iproute2 in itself is adequate to handle fallover routing when one of the outside links goes down - that is, can it just be set up with lower priority rules to route the other way, or does something like mon (http://www.kernel.org/software/mon/) need to be set up to actively change the routing tables when an outside line goes down? \/\/ I-I I T Blauvelt whit@transpect.com From s965817@uia.ua.ac.be Wed Nov 15 00:10:45 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from gems.uia.ac.be (hgems.uia.ac.be [143.169.254.10]) by outpost.ds9a.nl (Postfix) with ESMTP id BBEA37504B for ; Wed, 15 Nov 2000 00:10:44 +0100 (CET) Received: from localhost (s965817@localhost) by gems.uia.ac.be (8.11.0/8.11.0) with ESMTP id eAENAfh29360 for ; Wed, 15 Nov 2000 00:10:41 +0100 (MET) Date: Wed, 15 Nov 2000 00:10:41 +0100 (MET) From: "Wingtung.Leung" X-Sender: Cc: Linux Advanced Router & Traffic Control Subject: Re: [LARTC] A complicated routing scenario (for me at least) In-Reply-To: <3A119D73.E5F9D7E8@uccsda.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 164 Status: O Content-Length: 1156 Lines: 29 On Tue, 14 Nov 2000, Andrew wrote: > OK.. someplace else to look. Are the examples the only thing available > in the way of file syntax? Also could someone help me understand how > these files are read at startup if they exist. (what code/script is > responsible for doing it, and what happens if there are syntax errors. I > have a redhat 6.2 system.) Maybe you should try it first and experiment a bit. It's rather hard to answer on vague questions. > Since the TOS field doesn't change (an assumption, is this true?) I > would know which interface to route the packet back through while at the > same time being able to reset the TOS field back to zero for routing on > the internet. As far as I understand your question: you can change the TOS based on the incoming interface (and lots of other options). And I think it isn't usefull to reset the TOS field when you send out the packets into the internet, because most routers won't use the field and simply ignore it. When a packets comes back, you should route it dependand on the destination, not on the TOS field because that can be anything. I hope I haven't told complete nonsense. Tung From arthurvl@sci.kun.nl Wed Nov 15 11:49:52 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from wn1.sci.kun.nl (wn1.sci.kun.nl [131.174.8.1]) by outpost.ds9a.nl (Postfix) with ESMTP id 299FB7504C for ; Wed, 15 Nov 2000 11:49:52 +0100 (CET) Received: from studs3.sci.kun.nl by wn1.sci.kun.nl via studs3.sci.kun.nl [131.174.124.4] with ESMTP for id LAA18843 (8.8.8/3.30); Wed, 15 Nov 2000 11:49:41 +0100 (MET) Date: Wed, 15 Nov 2000 11:49:50 +0100 (MET) From: Arthur van Leeuwen To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] A complicated routing scenario (for me at least) In-Reply-To: <20001114164728.B1644@www.transpect.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 165 Status: O Content-Length: 1274 Lines: 31 On Tue, 14 Nov 2000, Whit wrote: > Andrew, > I'm awfully glad you're asking these questions, since I'm contemplating a > similar setup and am not yet to that wonderful place where this presently > obscure new technology resolves into clarity. So I'll be trying to follow > along closely as you work out your scheme. Hey, I've never done stuff like Andrew's proposing either. It's cool. I want to know if it'll work. :) > One question I have, in addition to those you're asking, is whether iproute2 > in itself is adequate to handle fallover routing when one of the outside > links goes down - that is, can it just be set up with lower priority rules > to route the other way, or does something like mon > (http://www.kernel.org/software/mon/) need to be set up to actively change > the routing tables when an outside line goes down? Hmmm. Methinks that with the preferences associated with routes and the effects of neighbor unreachability detection this should work. This remark is wholly untested, though. Doei, Arthur. -- /\ / | arthurvl@sci.kun.nl | Work like you don't need the money /__\ / | A friend is someone with whom | Love like you have never been hurt / \/__ | you can dare to be yourself | Dance like there's nobody watching From arthurvl@sci.kun.nl Wed Nov 15 12:27:32 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from wn1.sci.kun.nl (wn1.sci.kun.nl [131.174.8.1]) by outpost.ds9a.nl (Postfix) with ESMTP id C74FF75066 for ; Wed, 15 Nov 2000 12:27:31 +0100 (CET) Received: from studs3.sci.kun.nl by wn1.sci.kun.nl via studs3.sci.kun.nl [131.174.124.4] with ESMTP id MAA25419 (8.8.8/3.30); Wed, 15 Nov 2000 12:27:20 +0100 (MET) Date: Wed, 15 Nov 2000 12:27:29 +0100 (MET) From: Arthur van Leeuwen To: "Wingtung.Leung" Cc: Linux Advanced Router & Traffic Control Subject: Re: [LARTC] A complicated routing scenario (for me at least) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 166 Status: O Content-Length: 1664 Lines: 43 On Wed, 15 Nov 2000, Wingtung.Leung wrote: > > On Tue, 14 Nov 2000, Andrew wrote: > > > OK.. someplace else to look. Are the examples the only thing available > > in the way of file syntax? Also could someone help me understand how > > these files are read at startup if they exist. (what code/script is > > responsible for doing it, and what happens if there are syntax errors. I > > have a redhat 6.2 system.) > > Maybe you should try it first and experiment a bit. It's rather hard to > answer on vague questions. But not impossible. There is the iproute2 code that does the actual parsing of the files in /etc/iproute2, and there is some information in the ip-cref doc. The parser is the function rtnl_tab_initialize in lib/rt_names.c of the iproute2 source tree. The syntax is one of the following for scanf formats (read the manpage for scanf if you can't parse these by sight): 0x%x %s\n 0x%x %s # %d %s\n %d %s # Implied is basically a key-value table, with decimal or hexadecimal numbers as keys and strings as values. Comments are allowed and whitespace is mostly ignored. There has to be some between keys and values though. :) If there are syntax errors you will only see numbers instead of nice user friendly names, after the ip or tc tool has complained about 'Database is corrupted at ', with one of the files instead of and part of the file instead of Doei, Arthur. -- /\ / | arthurvl@sci.kun.nl | Work like you don't need the money /__\ / | A friend is someone with whom | Love like you have never been hurt / \/__ | you can dare to be yourself | Dance like there's nobody watching From thomas@habets.pp.se Wed Nov 22 15:04:00 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id AF2197504B for ; Wed, 22 Nov 2000 15:03:55 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13yaUx-0002i3-01 for ; Wed, 22 Nov 2000 15:03:43 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13yNO6-0006vV-00 for ; Wed, 22 Nov 2000 01:03:46 +0100 From: Thomas Habets To: LARTC@mailman.ds9a.nl Date: Wed, 22 Nov 2000 01:00:08 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain MIME-Version: 1.0 Message-Id: <00112201000800.01070@marvin> Content-Transfer-Encoding: 8bit Subject: [LARTC] Bandwidth limiting Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 204 Status: O Content-Length: 811 Lines: 27 Hello. I need help with limiting bandwidth. I have read every tutorial I've come over and I just can't make anything work. Ok, here's the scenario: I have a gateway, which has five network interfaces (eth0 -> eth4), eth0 is the 'external' one and eth[1-4] are supposed to be limited to 128Kbit/s each. The interfaces eth[1-4] each have a C-class net, 192.168.[1-4].0/24. Thanks for any and all help. linux 2.4.0-test9 debian 2.2 (potato) --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From daniel@netatonce.se Wed Nov 22 15:24:41 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail.citynet.nu (mail.citynet.nu [217.10.96.131]) by outpost.ds9a.nl (Postfix) with ESMTP id B96D87504B for ; Wed, 22 Nov 2000 15:24:40 +0100 (CET) Received: from winnt [10.1.2.101] by mail.citynet.nu (SMTPD32-6.05) id A70E78302A2; Wed, 22 Nov 2000 15:24:14 +0100 From: "Daniel Bergqvist" To: "Thomas Habets" , Subject: SV: [LARTC] Bandwidth limiting Date: Wed, 22 Nov 2000 15:25:18 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-Reply-To: <00112201000800.01070@marvin> Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 205 Status: O Content-Length: 1050 Lines: 43 Hi, What doesn't work? Do you get error messages when you run TC or don't you know how to use TC? Regards, Daniel -----Ursprungligt meddelande----- Från: lartc-admin@mailman.ds9a.nl [mailto:lartc-admin@mailman.ds9a.nl]För Thomas Habets Hello. I need help with limiting bandwidth. I have read every tutorial I've come over and I just can't make anything work. Ok, here's the scenario: I have a gateway, which has five network interfaces (eth0 -> eth4), eth0 is the 'external' one and eth[1-4] are supposed to be limited to 128Kbit/s each. The interfaces eth[1-4] each have a C-class net, 192.168.[1-4].0/24. Thanks for any and all help. linux 2.4.0-test9 debian 2.2 (potato) --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From thomas@habets.pp.se Wed Nov 22 17:34:28 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id 2DB517504B for ; Wed, 22 Nov 2000 17:34:25 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13ycqh-0003ke-00; Wed, 22 Nov 2000 17:34:19 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13ycux-0008NW-00; Wed, 22 Nov 2000 17:38:43 +0100 From: Thomas Habets To: daniel@netatonce.se, lartc@mailman.ds9a.nl Subject: Re: [LARTC] Bandwidth limiting Date: Wed, 22 Nov 2000 17:35:04 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain MIME-Version: 1.0 Message-Id: <00112217350400.00481@marvin> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 208 Status: O Content-Length: 670 Lines: 18 (I got this answer from the archives, I have not received it by mail. Odd) >What doesn't work? Do you get error messages when you run TC or don't you >know how to use TC? I don't know how to use TC, which got me to read tutorials and try things for hours and hours. Nothing I've tried limits bandwidth. --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From daniel@netatonce.se Wed Nov 22 17:58:08 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail.citynet.nu (mail.citynet.nu [217.10.96.131]) by outpost.ds9a.nl (Postfix) with ESMTP id 1F0477504C for ; Wed, 22 Nov 2000 17:58:08 +0100 (CET) Received: from winnt [10.1.2.101] by mail.citynet.nu (SMTPD32-6.05) id AB0A1CA021C; Wed, 22 Nov 2000 17:57:46 +0100 From: "Daniel Bergqvist" To: "Thomas Habets" , Subject: SV: [LARTC] Bandwidth limiting Date: Wed, 22 Nov 2000 17:58:49 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <00112217350400.00481@marvin> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 209 Status: O Content-Length: 1328 Lines: 44 Try: tc qdisc add dev eth1 root tbf rate 10kbit buffer 5kb/8 limit 10kb This adds an token bucket flow qdisc to eth1 and limits traffic to 10kbit/s. Note: It only limits outgoing traffic, not incomming traffic. Regards Daniel -----Ursprungligt meddelande----- Från: lartc-admin@mailman.ds9a.nl [mailto:lartc-admin@mailman.ds9a.nl]För Thomas Habets Skickat: Wednesday, November 22, 2000 5:35 PM Till: daniel@netatonce.se; lartc@mailman.ds9a.nl Ämne: Re: [LARTC] Bandwidth limiting (I got this answer from the archives, I have not received it by mail. Odd) >What doesn't work? Do you get error messages when you run TC or don't you >know how to use TC? I don't know how to use TC, which got me to read tutorials and try things for hours and hours. Nothing I've tried limits bandwidth. --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/ From thomas@habets.pp.se Thu Nov 23 00:38:42 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id 9929E7504B for ; Thu, 23 Nov 2000 00:38:41 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13yjTE-0005ny-00; Thu, 23 Nov 2000 00:38:32 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13yjXX-0000h6-01; Thu, 23 Nov 2000 00:42:59 +0100 From: Thomas Habets To: "Daniel Bergqvist" , Subject: Re: [LARTC] Bandwidth limiting Date: Thu, 23 Nov 2000 00:35:27 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain References: In-Reply-To: MIME-Version: 1.0 Message-Id: <00112300352703.00481@marvin> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 210 Status: O Content-Length: 826 Lines: 22 On Wed, 22 Nov 2000, Daniel Bergqvist wrote: > tc qdisc add dev eth1 root tbf rate 10kbit buffer 5kb/8 limit 10kb It works perfectly, thank you very much. > This adds an token bucket flow qdisc to eth1 and limits traffic to > 10kbit/s. Note: It only limits outgoing traffic, not incomming traffic. Hmm... and how do I set it up to limit incomming? Since the interface behind the gateway has just one C-class net I assume it's pretty easy, but not for me. :( --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From daniel@netatonce.se Thu Nov 23 10:11:45 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail.citynet.nu (mail.citynet.nu [217.10.96.131]) by outpost.ds9a.nl (Postfix) with ESMTP id A1AFA7504C for ; Thu, 23 Nov 2000 10:11:44 +0100 (CET) Received: from winnt [10.1.2.101] by mail.citynet.nu (SMTPD32-6.05) id AF3B1A0E023A; Thu, 23 Nov 2000 10:11:23 +0100 From: "Daniel Bergqvist" To: "Thomas Habets" , Subject: SV: [LARTC] Bandwidth limiting Date: Thu, 23 Nov 2000 10:12:29 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <00112300352703.00481@marvin> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 212 Status: O Content-Length: 1358 Lines: 41 To limit incomming traffic you either limit the traffic when it goes out on another interface, or you use the ingress qdisc. I suggest that you try the first. Assume you have a router with two interfaces, eth0 and eth1, when you may limit incomming traffic on eth0 by limit outgoing traffic on eth1. Regards, Daniel -----Ursprungligt meddelande----- Från: Thomas Habets [mailto:thomas@habets.pp.se] Skickat: Thursday, November 23, 2000 12:35 AM Till: Daniel Bergqvist; lartc@mailman.ds9a.nl Ämne: Re: [LARTC] Bandwidth limiting On Wed, 22 Nov 2000, Daniel Bergqvist wrote: > tc qdisc add dev eth1 root tbf rate 10kbit buffer 5kb/8 limit 10kb It works perfectly, thank you very much. > This adds an token bucket flow qdisc to eth1 and limits traffic to > 10kbit/s. Note: It only limits outgoing traffic, not incomming traffic. Hmm... and how do I set it up to limit incomming? Since the interface behind the gateway has just one C-class net I assume it's pretty easy, but not for me. :( --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From thomas@habets.pp.se Thu Nov 23 17:07:36 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id 811097504B for ; Thu, 23 Nov 2000 17:07:36 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13yyrI-0002WE-00; Thu, 23 Nov 2000 17:04:24 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13yyvg-00027G-00; Thu, 23 Nov 2000 17:08:56 +0100 From: Thomas Habets To: "Daniel Bergqvist" , Subject: Re: SV: [LARTC] Bandwidth limiting Date: Thu, 23 Nov 2000 17:05:10 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain References: In-Reply-To: MIME-Version: 1.0 Message-Id: <00112317051000.00570@marvin> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 214 Status: O Content-Length: 660 Lines: 17 On Thu, 23 Nov 2000, Daniel Bergqvist wrote: > Assume you have a router with two interfaces, eth0 and eth1, when you may > limit incomming traffic on eth0 by limit outgoing traffic on eth1. I thought of that, but the problem is that I have four interfaces on the gateway plus the external one. --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From thomas@habets.pp.se Thu Nov 23 17:09:24 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id 6A02C7504B for ; Thu, 23 Nov 2000 17:09:24 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13yyw5-0002Zw-00; Thu, 23 Nov 2000 17:09:21 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13yz0T-00027i-00; Thu, 23 Nov 2000 17:13:54 +0100 From: Thomas Habets To: "Daniel Bergqvist" , Subject: Re: SV: [LARTC] Bandwidth limiting Date: Thu, 23 Nov 2000 17:10:07 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain References: In-Reply-To: MIME-Version: 1.0 Message-Id: <00112317100701.00570@marvin> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 215 Status: O Content-Length: 815 Lines: 20 On Thu, 23 Nov 2000, Daniel Bergqvist wrote: > Assume you have a router with two interfaces, eth0 and eth1, when you may > limit incomming traffic on eth0 by limit outgoing traffic on eth1. I forgot to add to the last mail: the four interfaces behind the gateway should each be limited to 128Kbit in and 128Kbit out. 128 Kbit out now works for incomming traffic limiting thanks to the cmd I got from you (altered from 10Kbit to 128Kbit ofcourse). --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From s965817@uia.ua.ac.be Thu Nov 23 17:21:36 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from gems.uia.ac.be (hgems.uia.ac.be [143.169.254.10]) by outpost.ds9a.nl (Postfix) with ESMTP id 628897504B for ; Thu, 23 Nov 2000 17:21:36 +0100 (CET) Received: from localhost (s965817@localhost) by gems.uia.ac.be (8.11.0/8.11.0) with ESMTP id eANGLX106239 for ; Thu, 23 Nov 2000 17:21:33 +0100 (MET) Date: Thu, 23 Nov 2000 17:21:33 +0100 (MET) From: "Wingtung.Leung" X-Sender: Cc: Linux Advanced Router & Traffic Control Subject: Re: SV: [LARTC] Bandwidth limiting In-Reply-To: <00112317051000.00570@marvin> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 216 Status: O Content-Length: 555 Lines: 15 I don't see the problem. You can specify the limit on the outgoing interfaces, depending on the incoming interface. Using firewall marks is quite easy. Have you tried the example setup from the HOWTO? On Thu, 23 Nov 2000, Thomas Habets wrote: > On Thu, 23 Nov 2000, Daniel Bergqvist wrote: > > Assume you have a router with two interfaces, eth0 and eth1, when you may > > limit incomming traffic on eth0 by limit outgoing traffic on eth1. > > I thought of that, but the problem is that I have four interfaces on the > gateway plus the external one. > From thomas@habets.pp.se Fri Nov 24 15:52:33 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mail2.edu.stockholm.se (mail2.edu.stockholm.se [193.12.6.147]) by outpost.ds9a.nl (Postfix) with ESMTP id D57F47504C for ; Fri, 24 Nov 2000 15:52:32 +0100 (CET) Received: from [193.15.107.93] (helo=monkey.nss.nu ident=mail) by mail2.edu.stockholm.se with esmtp (Exim 3.12 #1 (Debian)) id 13zKDG-0001fI-00; Fri, 24 Nov 2000 15:52:30 +0100 Received: from h56n1fls20o94.telia.com ([212.181.128.56] helo=marvin) by monkey.nss.nu with smtp (Exim 3.12 #1 (Debian)) id 13zKHm-0004En-00; Fri, 24 Nov 2000 15:57:10 +0100 From: Thomas Habets To: "Wingtung.Leung" , Linux Advanced Router & Traffic Control Subject: Re: SV: [LARTC] Bandwidth limiting Date: Fri, 24 Nov 2000 15:53:16 +0100 X-Mailer: KMail [version 1.1.95.2] Content-Type: text/plain References: In-Reply-To: MIME-Version: 1.0 Message-Id: <00112415531600.00978@marvin> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 217 Status: O Content-Length: 972 Lines: 27 On Thu, 23 Nov 2000, you wrote: > I don't see the problem. You can specify the limit on the outgoing > interfaces, depending on the incoming interface. Using firewall marks is > quite easy. I bet it is, since iptables is easy. Haven't learned to use fwmarks yet though. >Have you tried the example setup from the HOWTO? Yes, and after *another* long starring and testing pass I'm pretty sure I got it to work with the sfq or u32 or something, not really sure what did what though, but it'll come to me. Why can't it just be like: iptables -t shaper -A OUTPUT -s 1.2.3.0/24 --maxspeed=128Kbit -j SHAPE --------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux 2.2" }; char *pgpKey[] = { "finger -m thompa@darkface.pp.se" }; char pgpfinger[] = { "6517 2898 6AED EA2C 1015 DCF0 8E53 B69F 524B B541" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t; From s965817@uia.ua.ac.be Fri Nov 24 22:37:26 2000 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from gems.uia.ac.be (hgems.uia.ac.be [143.169.254.10]) by outpost.ds9a.nl (Postfix) with ESMTP id D26E57504C for ; Fri, 24 Nov 2000 22:37:25 +0100 (CET) Received: from localhost (s965817@localhost) by gems.uia.ac.be (8.11.0/8.11.0) with ESMTP id eAOLbNg27522 for ; Fri, 24 Nov 2000 22:37:23 +0100 (MET) Date: Fri, 24 Nov 2000 22:37:23 +0100 (MET) From: "Wingtung.Leung" X-Sender: Cc: Linux Advanced Router & Traffic Control Subject: Re: SV: [LARTC] Bandwidth limiting In-Reply-To: <00112415531600.00978@marvin> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 220 Status: O Content-Length: 524 Lines: 17 On Fri, 24 Nov 2000, Thomas Habets wrote: > > Why can't it just be like: > iptables -t shaper -A OUTPUT -s 1.2.3.0/24 --maxspeed=128Kbit -j SHAPE > Because iptables is used for firewalling (packet filtering) functions and tc (and ip) handle queuing and routing. There is an options for iptables to limit rate (check the man page), but if you need "the real stuff", I suppose tc is the way to go. It supports more flexible setups. Too bad we are still missing a extensive reference for tc, but Daniel is working on it. From db@cyclonehq.dnsalias.net Fri Jan 12 06:21:03 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from cyclonehq.dnsalias.net (c837140-a.vncvr1.wa.home.com [65.0.81.146]) by outpost.ds9a.nl (Postfix) with ESMTP id AE56F7504C for ; Fri, 12 Jan 2001 06:21:01 +0100 (CET) Received: from danb.cyclonehq.dnsalias.net ([10.0.0.58]) by cyclonehq.dnsalias.net (8.11.0/8.8.7) with ESMTP id f0C3bfR05258; Thu, 11 Jan 2001 19:37:41 -0800 Message-Id: <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> X-Sender: db@10.0.0.254 X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Thu, 11 Jan 2001 19:31:57 -0800 To: lartc@mailman.ds9a.nl From: Dan B Cc: danb@cyclonecomputers.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: [LARTC] HTTP only works on second try from doublely NAT'ed windows box Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 334 Status: O Content-Length: 1398 Lines: 44 If this is a FAQ, may I be shot on site. Problem: ------- Every windows box on my network has to hit refresh once before a web site will come up. It's as if the first try it doesn't have any gateway at all, but the second try works. However, ping's always work flawlessly, so I assume this is an Internet explorer or TCP/HTTP traffic problem. Here's my setup: --------------- Internet | | DSL Router (64.x.x.130 external, and 10.0.0.250 internal) | | Linux Box (10.0.0.251 internal/mapped to external 64.x.x.131 by DSL router NAT) | | Windows98 (10.0.0.122 internal - NAT'ed to 64.x.x.131 by Linux Box & DSL router before reaching Internet) The Linux Box uses the router as it's gateway (of course) and I have configured the DSL router to use NAT to translate 10.0.0.251 to 64.x.x.131. This works fine. Similarly, I have configured the Windows98 box to use Linux as it's gateway, and Linux uses NAT to translate 10.0.0.122 into 10.0.0.251 - which is then translated into 64.x.x.131 before it goes out to the Internet). If I tell the Windows98 box to use 10.0.0.250 as it's gateway, then everything works perfectly. Any tips? And yes, there are reasons why I have it configured this way. (e.g., there are 3 linux servers that each have an internal/external mapping done by the dsl router). Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com From ahu@home.ds9a.nl Fri Jan 12 15:43:59 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (5dyn37.com21.casema.net [212.64.96.37]) by outpost.ds9a.nl (Postfix) with SMTP id 52C9D7507C for ; Fri, 12 Jan 2001 15:43:59 +0100 (CET) Received: (qmail 22614 invoked by uid 500); 12 Jan 2001 14:43:18 -0000 Date: Fri, 12 Jan 2001 15:43:18 +0100 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box Message-ID: <20010112154318.B22569@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254>; from db@cyclonehq.dnsalias.net on Thu, Jan 11, 2001 at 07:31:57PM -0800 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 338 Status: O Content-Length: 996 Lines: 38 On Thu, Jan 11, 2001 at 07:31:57PM -0800, Dan B wrote: > If this is a FAQ, may I be shot on site. Well :-) > Here's my setup: > --------------- > Internet > | > | > DSL Router (64.x.x.130 external, and 10.0.0.250 internal) > | > | > Linux Box (10.0.0.251 internal/mapped to external 64.x.x.131 by DSL router > NAT) > | > | > Windows98 (10.0.0.122 internal - NAT'ed to 64.x.x.131 by Linux Box & DSL > router before reaching Internet) Are the DSL Router, the Linux Box and the Windows 98 machines all on a single subnet, of interface? In that case the Linux box may be sending out ICMP Redirects. Linux machines might react instantly to those redirects, Windows only on the second try? Use the great tool tcpdump of ethereal to find out what is exactly being sent over the wire. Regards, bert hubert -- PowerDNS Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From db@cyclonehq.dnsalias.net Fri Feb 2 05:01:18 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from cyclonehq.dnsalias.net (c837140-a.vncvr1.wa.home.com [65.0.81.146]) by outpost.ds9a.nl (Postfix) with ESMTP id D5B9875050 for ; Fri, 2 Feb 2001 05:01:16 +0100 (CET) Received: from danb.cyclonehq.dnsalias.net (danb [10.0.0.103]) by cyclonehq.dnsalias.net (8.11.0/8.8.7) with ESMTP id f1247jN30632 for ; Thu, 1 Feb 2001 20:07:45 -0800 Message-Id: <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> X-Sender: db@10.0.0.254 X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Thu, 01 Feb 2001 20:00:23 -0800 To: lartc@mailman.ds9a.nl From: Dan B Subject: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box In-Reply-To: <20010112154318.B22569@home.ds9a.nl> References: <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 419 Status: O Content-Length: 1229 Lines: 43 > > Here's my setup: > > --------------- > > Internet > > | > > | > > DSL Router (64.x.x.130 external, and 10.0.0.250 internal) > > | > > | > > Linux Box (10.0.0.251 internal/mapped to external 64.x.x.131 by DSL > router > > NAT) > > | > > | > > Windows98 (10.0.0.122 internal - NAT'ed to 64.x.x.131 by Linux Box & DSL > > router before reaching Internet) > >Are the DSL Router, the Linux Box and the Windows 98 machines all on a >single subnet, of interface? In that case the Linux box may be sending out >ICMP Redirects. Linux machines might react instantly to those redirects, >Windows only on the second try? > >Use the great tool tcpdump of ethereal to find out what is exactly being >sent over the wire. > >Regards, > >bert hubert It's been a few weeks for me to think about my problem, and I think I finally figured out what you meant by what you said, Bert. I think my problem is the linux box is trying to NAT between two interfaces even though they are on the same subnet. (duh! tcp/ip 101). So I'm going to try changing the Linux box to 10.0.0.251/255.255.255.248, and the windows98 box to 10.0.0.122/255.255.255.128, and see if the NAT will work correctly after that. Thanks, again! -Dan From db@cyclonehq.dnsalias.net Sat Feb 10 05:53:51 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from cyclonehq.dnsalias.net (c837140-a.vncvr1.wa.home.com [65.0.81.146]) by outpost.ds9a.nl (Postfix) with ESMTP id 9ECE275054 for ; Sat, 10 Feb 2001 05:53:50 +0100 (CET) Received: from danb.cyclonehq.dnsalias.net (danb [10.0.0.103]) by cyclonehq.dnsalias.net (8.11.0/8.8.7) with ESMTP id f1A50qk21728 for ; Fri, 9 Feb 2001 21:00:52 -0800 Message-Id: <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> X-Sender: db@10.0.0.254 X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Fri, 09 Feb 2001 20:52:56 -0800 To: lartc@mailman.ds9a.nl From: Dan B Subject: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box In-Reply-To: <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> References: <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 472 Status: O Content-Length: 1473 Lines: 47 At 08:00 PM 2/1/2001 -0800, Dan B wrote: >> > Here's my setup: >> > --------------- >> > Internet >> > | >> > | >> > DSL Router (64.x.x.130 external, and 10.0.0.250 internal) >> > | >> > | >> > Linux Box (10.0.0.251 internal/mapped to external 64.x.x.131 by DSL >> router >> > NAT) >> > | >> > | >> > Windows98 (10.0.0.122 internal - NAT'ed to 64.x.x.131 by Linux Box & DSL >> > router before reaching Internet) >> >>Are the DSL Router, the Linux Box and the Windows 98 machines all on a >>single subnet, of interface? In that case the Linux box may be sending out >>ICMP Redirects. Linux machines might react instantly to those redirects, >>Windows only on the second try? >> >>Use the great tool tcpdump of ethereal to find out what is exactly being >>sent over the wire. >> >>Regards, >> >>bert hubert > > >It's been a few weeks for me to think about my problem, and I think I >finally figured out what you meant by what you said, Bert. I think my >problem is the linux box is trying to NAT between two interfaces even >though they are on the same subnet. (duh! tcp/ip 101). > >So I'm going to try changing the Linux box to 10.0.0.251/255.255.255.248, >and the windows98 box to 10.0.0.122/255.255.255.128, and see if the NAT >will work correctly after that. That fixed it. :-) (I gotta remember that you can't NAT / route between two computers on the same subnet very well). Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com From ahu@home.ds9a.nl Sat Feb 10 14:00:00 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from home.ds9a.nl (4dyn38.com21.casema.net [212.64.95.38]) by outpost.ds9a.nl (Postfix) with SMTP id 0C74175068 for ; Sat, 10 Feb 2001 13:59:59 +0100 (CET) Received: (qmail 10381 invoked by uid 500); 10 Feb 2001 13:52:17 -0000 Date: Sat, 10 Feb 2001 14:52:17 +0100 From: bert hubert To: lartc@mailman.ds9a.nl Subject: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box Message-ID: <20010210145217.B10335@home.ds9a.nl> Mail-Followup-To: lartc@mailman.ds9a.nl References: <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254>; from db@cyclonehq.dnsalias.net on Fri, Feb 09, 2001 at 08:52:56PM -0800 Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 476 Status: O Content-Length: 669 Lines: 21 On Fri, Feb 09, 2001 at 08:52:56PM -0800, Dan B wrote: > >So I'm going to try changing the Linux box to 10.0.0.251/255.255.255.248, > >and the windows98 box to 10.0.0.122/255.255.255.128, and see if the NAT > >will work correctly after that. > > That fixed it. :-) (I gotta remember that you can't NAT / route between two > computers on the same subnet very well). You can, I think, but you need to be very sure that your NAT machine isn't sending out any ICMP Redirects. Regards, bert -- http://www.PowerDNS.com Versatile DNS Services Trilab The Technology People 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet From rbrito@iname.com Sun Feb 11 05:36:45 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from dumont.rtb.ath.cx (200-221-84-35.dsl-sp.uol.com.br [200.221.84.35]) by outpost.ds9a.nl (Postfix) with SMTP id C90A3750F5 for ; Sun, 11 Feb 2001 05:36:44 +0100 (CET) Received: (qmail 1333 invoked by uid 1000); 11 Feb 2001 04:36:43 -0000 Date: Sun, 11 Feb 2001 02:36:43 -0200 From: Rogerio Brito To: lartc@mailman.ds9a.nl Subject: Preventing ICMP Redirects? (was: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box) Message-ID: <20010211023643.B1302@iname.com> References: <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> <20010210145217.B10335@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.12i In-Reply-To: <20010210145217.B10335@home.ds9a.nl> Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 479 Status: O Content-Length: 1302 Lines: 33 On Feb 10 2001, bert hubert wrote: > You can, I think, but you need to be very sure that your NAT machine > isn't sending out any ICMP Redirects. I've been bitten by these ICMP Redirects once. Is there any way to prevent them from being sent out? Perhaps doing some packet filtering of the ICMP Redirects? Even if this works, this sure sounds like a dirty solution... :-( In that occasion, I was trying to set up a masquerading box with only one NIC and two IP addresses (the Internet-valid one and the private one), hooking everything in a single hub and routing accordingly. I don't remember the details (since this was many months ago), but the only solution that I could make work was to buy another NIC for the masquerading box and put one IP in each NIC, doing everything as usual. :-( As I don't remember more details of the situation, I'm just hoping that this description rings a bell for someone. Any explanation of how to make this setup with just one NIC or comments on why this shouldn't be done are immensely appreciated. Thanks in advance, Roger... -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Rogerio Brito - rbrito@iname.com - http://www.ime.usp.br/~rbrito/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From suthep@paradyne.yi.org Tue Feb 13 10:02:08 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from mickey.paradyne.yi.org (adsl116.mn.uswest.net [209.181.254.116]) by outpost.ds9a.nl (Postfix) with ESMTP id DFE2A7504B for ; Tue, 13 Feb 2001 10:02:07 +0100 (CET) Received: (from suthep@localhost) by mickey.paradyne.yi.org (8.11.1/8.11.1) id f1D920Z05222; Tue, 13 Feb 2001 03:02:00 -0600 Date: Tue, 13 Feb 2001 03:02:00 -0600 From: Suthep Vichiendilokkul To: Rogerio Brito Cc: lartc@mailman.ds9a.nl Message-ID: <20010213030200.E30582@mickey.paradyne.yi.org> References: <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> <20010210145217.B10335@home.ds9a.nl> <20010211023643.B1302@iname.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010211023643.B1302@iname.com>; from rbrito@iname.com on Sun, Feb 11, 2001 at 02:36:43AM -0200 Subject: [LARTC] Re: Preventing ICMP Redirects? Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 485 Status: O Content-Length: 1751 Lines: 46 On Sun, Feb 11, 2001 at 02:36:43AM -0200, Rogerio Brito wrote: > I've been bitten by these ICMP Redirects once. Is there any > way to prevent them from being sent out? Perhaps doing some Hmmm. I never tried this before, but how about setting these kernel variables to 0? (depending on what you want): /proc/sys/net/ipv4/conf//accept_redirects /proc/sys/net/ipv4/conf//send_redirects Note that I'm using kernel 2.4. I'm not sure they are available in 2.2, though. Suthep > packet filtering of the ICMP Redirects? Even if this works, > this sure sounds like a dirty solution... :-( > > In that occasion, I was trying to set up a masquerading box > with only one NIC and two IP addresses (the Internet-valid one > and the private one), hooking everything in a single hub and > routing accordingly. > > I don't remember the details (since this was many months ago), > but the only solution that I could make work was to buy > another NIC for the masquerading box and put one IP in each > NIC, doing everything as usual. :-( > > As I don't remember more details of the situation, I'm just > hoping that this description rings a bell for someone. Any > explanation of how to make this setup with just one NIC or > comments on why this shouldn't be done are immensely > appreciated. > > > Thanks in advance, Roger... > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Rogerio Brito - rbrito@iname.com - http://www.ime.usp.br/~rbrito/ > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > _______________________________________________ > LARTC mailing list / LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/ From rbrito@iname.com Tue Feb 13 21:06:58 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from dumont.rtb.ath.cx (200-221-84-35.dsl-sp.uol.com.br [200.221.84.35]) by outpost.ds9a.nl (Postfix) with SMTP id 64E3E7504B for ; Tue, 13 Feb 2001 21:06:56 +0100 (CET) Received: (qmail 4731 invoked by uid 1000); 13 Feb 2001 20:06:46 -0000 Date: Tue, 13 Feb 2001 18:06:46 -0200 From: Rogerio Brito To: lartc@mailman.ds9a.nl Message-ID: <20010213180646.A4721@iname.com> References: <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> <20010210145217.B10335@home.ds9a.nl> <20010211023643.B1302@iname.com> <20010213030200.E30582@mickey.paradyne.yi.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.12i In-Reply-To: <20010213030200.E30582@mickey.paradyne.yi.org> Subject: [LARTC] Re: Preventing ICMP Redirects? Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 486 Status: O Content-Length: 832 Lines: 24 On Feb 13 2001, Suthep Vichiendilokkul wrote: > On Sun, Feb 11, 2001 at 02:36:43AM -0200, Rogerio Brito wrote: > > I've been bitten by these ICMP Redirects once. Is there any > > way to prevent them from being sent out? Perhaps doing some First of all, I'd like to thank everybody who replied. A sincere thanks. > Hmmm. I never tried this before, but how about setting these kernel > variables to 0? (depending on what you want): > > /proc/sys/net/ipv4/conf//accept_redirects > /proc/sys/net/ipv4/conf//send_redirects Yes, I'm using Linux 2.2.18 and they are available here. Thanks again, Roger... -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Rogerio Brito - rbrito@iname.com - http://www.ime.usp.br/~rbrito/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From db@cyclonehq.dnsalias.net Thu Feb 15 05:45:28 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from cyclonehq.dnsalias.net (c837140-a.vncvr1.wa.home.com [65.0.81.146]) by outpost.ds9a.nl (Postfix) with ESMTP id 787B47504C for ; Thu, 15 Feb 2001 05:45:27 +0100 (CET) Received: from danb.cyclonehq.dnsalias.net (danb [10.0.0.103]) by cyclonehq.dnsalias.net (8.11.0/8.8.7) with ESMTP id f1F4qoc14593 for ; Wed, 14 Feb 2001 20:52:50 -0800 Message-Id: <5.0.2.1.0.20010214204129.031834c0@cyclonehq.dnsalias.net> X-Sender: db@cyclonehq.dnsalias.net X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Wed, 14 Feb 2001 20:44:30 -0800 To: lartc@mailman.ds9a.nl From: Dan B Subject: Re: Preventing ICMP Redirects? (was: Re: [LARTC] HTTP only works on second try from doublely NAT'ed windows box) In-Reply-To: <20010211023643.B1302@iname.com> References: <20010210145217.B10335@home.ds9a.nl> <20010112154318.B22569@home.ds9a.nl> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010111192024.00ad5980@10.0.0.254> <5.0.2.1.0.20010201195651.02aa3008@10.0.0.254> <5.0.2.1.0.20010209205226.02a40e08@10.0.0.254> <20010210145217.B10335@home.ds9a.nl> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 492 Status: O Content-Length: 1732 Lines: 40 At 02:36 AM 2/11/2001 -0200, Rogerio Brito wrote: >On Feb 10 2001, bert hubert wrote: > > You can, I think, but you need to be very sure that your NAT machine > > isn't sending out any ICMP Redirects. > > I've been bitten by these ICMP Redirects once. Is there any > way to prevent them from being sent out? Perhaps doing some > packet filtering of the ICMP Redirects? Even if this works, > this sure sounds like a dirty solution... :-( > > In that occasion, I was trying to set up a masquerading box > with only one NIC and two IP addresses (the Internet-valid one > and the private one), hooking everything in a single hub and > routing accordingly. > > I don't remember the details (since this was many months ago), > but the only solution that I could make work was to buy > another NIC for the masquerading box and put one IP in each > NIC, doing everything as usual. :-( > > As I don't remember more details of the situation, I'm just > hoping that this description rings a bell for someone. Any > explanation of how to make this setup with just one NIC or > comments on why this shouldn't be done are immensely > appreciated. Even when you correctly aliased your single NIC to act like two interfaces? eth0:0 routable ip / external (seperate) subnet eth1:1 local ip / local subnet I've done what you described using aliasing a couple of times and I never got bit by ICMP redirects (like I did this last time). Now I kind of wish I would have fixed the ICMP redirect problem instead of just changing subnets. :-) Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com From hb@bitbyte.com.ar Tue Jul 17 00:00:21 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from bitbyte.com.ar (unknown [200.45.255.196]) by outpost.ds9a.nl (Postfix) with ESMTP id 9136B7504B for ; Tue, 17 Jul 2001 00:00:19 +0200 (CEST) Received: from chajari (host255199.arnet.net.ar [200.45.255.199] (may be forged)) by bitbyte.com.ar (8.11.0/8.8.7) with SMTP id f6GJ7N116767 for ; Mon, 16 Jul 2001 15:07:23 -0400 Message-ID: <00cb01bd1672$d6d4e040$c7ff2dc8@bitbyte.com.ar> From: "Hernan G. Brun" To: Date: Thu, 1 Jan 1998 02:05:11 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00C8_01BD1659.B12C1AC0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Subject: [LARTC] traffic shapper Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 1430 Status: RO Content-Length: 1161 Lines: 48 This is a multi-part message in MIME format. ------=_NextPart_000_00C8_01BD1659.B12C1AC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi folks! Can I do traffic shaping by user? In some docs I found, by device. I wish to assign for example: root : 2mb user1: 1mb user2: 1mb Thanks in advance! Hernan ------=_NextPart_000_00C8_01BD1659.B12C1AC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi folks!
Can I do traffic shaping by user?
In some docs I found, by device.
I wish to assign for example:
root : 2mb
user1: 1mb
user2: 1mb
 
Thanks in advance!
 
Hernan
------=_NextPart_000_00C8_01BD1659.B12C1AC0-- From stef.coene@belgacom.net Tue Jul 17 09:43:41 2001 Return-Path: Delivered-To: lartc@mailman.ds9a.nl Received: from riker.skynet.be (riker.skynet.be [195.238.3.132]) by outpost.ds9a.nl (Postfix) with ESMTP id 8E0D37504B for ; Tue, 17 Jul 2001 09:43:40 +0200 (CEST) Received: from scne (free13151.powered-by.skynet.be [62.4.179.95]) by riker.skynet.be (8.11.2/8.11.2/Skynet-OUT-2.11) with SMTP id f6H7hbO15865 for ; Tue, 17 Jul 2001 09:43:38 +0200 (MET DST) (envelope-from ) Content-Type: text/plain; charset="CP 1252" From: Stef Coene Organization: None To: Subject: Re: [LARTC] traffic shapper Date: Tue, 17 Jul 2001 08:26:14 +0200 X-Mailer: KMail [version 1.2] References: <00cb01bd1672$d6d4e040$c7ff2dc8@bitbyte.com.ar> In-Reply-To: <00cb01bd1672$d6d4e040$c7ff2dc8@bitbyte.com.ar> MIME-Version: 1.0 Message-Id: <01071708261400.01574@scne> Content-Transfer-Encoding: 8bit Sender: lartc-admin@mailman.ds9a.nl Errors-To: lartc-admin@mailman.ds9a.nl X-BeenThere: lartc@mailman.ds9a.nl X-Mailman-Version: 2.0beta6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Linux Advanced Routing & Traffic Control list List-Unsubscribe: , List-Archive: http://mailman.ds9a.nl/pipermail/lartc/ X-Keywords: X-UID: 1432 Status: RO Content-Length: 569 Lines: 22 On Thursday 01 January 1998 06:05, Hernan G. Brun wrote: > Hi folks! > Can I do traffic shaping by user? > In some docs I found, by device. > I wish to assign for example: > root : 2mb > user1: 1mb > user2: 1mb > > Thanks in advance! Yes you can. You can mark all the packets from a user with a mark and use that mark with the fw filter. But this is only valid for the local user on your shaping box and NOT the username they use to logon to the network. Stef -- stafke@iname.com stef.coene@belgacom.net More QOS info : http://users.belgacom.net/staf/ Mail-Cclient-1.12/testmbx/test_mpart.mbox0000644000076400007640000000377107535625432021124 0ustar wwwadminweb00000000000000From MAILER-DAEMON Thu Sep 5 10:58:41 2002 Date: 05 Sep 2002 10:58:41 +0100 From: Mail System Internal Data Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA X-IMAP: 1031219921 0000000000 Status: RO This text is part of the internal format of your mail folder, and is not a real message. It is created automatically by the mail system software. If deleted, important folder data will be lost, and it will be re-created with the data reset to initial values. From hdias@rosa.esb.ucp.pt Thu Sep 5 10:57:46 2002 Return-Path: Received: from localhost (hdias@localhost) by rosa.esb.ucp.pt (8.11.6/8.9.3) with ESMTP id g859vhv30340 for ; Thu, 5 Sep 2002 10:57:43 +0100 Date: Thu, 5 Sep 2002 10:57:43 +0100 (WEST) From: Henrique Dias To: wwwadmin@esb.ucp.pt Subject: This is a test!!! Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-1463810558-900984865-1031219863=:30307" Status: RO X-Status: X-Keywords: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---1463810558-900984865-1031219863=:30307 Content-Type: TEXT/PLAIN; charset=US-ASCII This is a test!!! -- --------------------------------------- Henrique Manuel Ribeiro Dias Escola Superior de Biotecnologia - UCP Gabinete de Desenvolvimento de Software Rua Dr. Antonio Bernardino de Almeida 4200 Porto Portugal Tel: 351-225580075 --------------------------------------- ---1463810558-900984865-1031219863=:30307 Content-Type: TEXT/plain; name="test.txt" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Test Content-Disposition: attachment; filename="test.txt" SXN0byDpIHVtIHRlc3RlISEhDQo= ---1463810558-900984865-1031219863=:30307-- Mail-Cclient-1.12/MANIFEST0000644000076400007640000000226510041247310015470 0ustar wwwadminweb00000000000000Artistic Cclient.pm Cclient.pod Cclient.xs Changes Copying criteria.c criteria.h examples/copy.txt examples/fetch_body.pl examples/fetch_structure.pl examples/imap.txt examples/list_mailboxs.pl examples/mime.txt examples/rfc822_date.pl examples/rfc822_output.txt examples/rfc822_parse_adrlist.pl examples/rfc822_write_address.pl examples/search_msg.txt examples/search.txt examples/smtp_mail_append.txt examples/smtp_mail_mpart.pl examples/smtp_mail.pl examples/sort.txt examples/struct.txt examples/summ.txt examples/thread_test.pl examples/thread.txt examples/utf8_mime2text.pl FAQ Makefile.PL MANIFEST README t/check.t t/elt.t t/expunge.t t/fetch_body.t t/fetch_header.t t/fetch_message.t t/fetch_mime.t t/fetch_structure.t t/fetch_text.t t/list.t t/msgno.t t/nmsgs.t t/parameters.t t/ping.t t/rfc822_8bit.t t/rfc822_base64.t t/rfc822_binary.t t/rfc822_date.t t/rfc822_parse_adrlist.t t/rfc822_qprint.t t/rfc822_write_address.t t/search_msg.t t/search.t t/smtp_open.t t/sort.t t/subscribe.t t/thread.t t/uid.t t/unsubscribe.t t/utf8_mime2text.t testmbx/multipart.mbox testmbx/test.mbox testmbx/test_mpart.mbox TODO typemap META.yml Module meta-data (added by MakeMaker) Mail-Cclient-1.12/typemap0000644000076400007640000000104307341423727015753 0ustar wwwadminweb00000000000000Mail::Cclient T_XSCPTR Mail::Cclient::SMTP T_PTROBJ INPUT T_XSCPTR STMT_START { MAGIC *mg; SV *sv = ($arg); if (sv == &sv_undef) $var = 0; else { if (!sv_isobject(sv)) croak(\"$var is not an object\"); sv = (SV*)SvRV(sv); if (!SvRMAGICAL(sv) || !(mg = mg_find(sv, '~')) || mg->mg_private != ${type}_MAGIC_SIGNATURE) { croak(\"$var is a forged ${ntype} object\"); } $var = ($type) SvIVX(mg->mg_obj); } } STMT_END OUTPUT T_XSCPTR sv_setsv($arg, get_mailstream_sv($var, \"${ntype}\")); Mail-Cclient-1.12/TODO0000644000076400007640000000033210130736101015020 0ustar wwwadminweb00000000000000This is a list over things that we plan to implement in Mail-Cclient-1.12. * $c->get_quota * $c->set_quota * $c->getacl * $c->setacl * $c->deleteacl * More examples * More tests * Fix bugs, if there are any... Mail-Cclient-1.12/Cclient.pod0000644000076400007640000011377210132020221016421 0ustar wwwadminweb00000000000000=pod =head1 NAME Mail::Cclient - Mailbox access via the c-client library API =head1 SYNOPSIS =head2 Mail::Cclient API use Mail::Cclient; $c = Mail::Cclient->new(MAILBOX [, OPTION ...]); # Old API deprecated in next versions ($envelope, $body) = $c->fetchstructure(MSGNO [, FLAG ...] ); $hdr = $c->fetchheader(MSGNO [, LINES [, FLAG ...]]); $text = $c->fetchtext(MSGNO [, FLAG ...]); $text = $c->fetchbody(MSGNO, SECTION [, FLAG ...]); $c->fetchflags(SEQUENCE); $c->fetchfast(SEQUENCE); # New API ($envelope, $body) = $c->fetch_structure(MSGNO [, FLAG ...] ); $msg = $c->fetch_message(MSGNO [, FLAG ...]); $hdr = $c->fetch_header(MSGNO, SECTION [, LINES [, FLAG ...]]); $text = $c->fetch_text(MSGNO, SECTION [, FLAG ...]); $mime = $c->fetch_mime(MSGNO, SECTION [, FLAG ...]); $text = $c->fetch_body(MSGNO, SECTION [, FLAG ...]); $c->fetch_flags(SEQUENCE); $c->fetch_fast(SEQUENCE); $elt = $c->elt(MSGNO); $c->create(MAILBOX); $c->delete(MAILBOX); $c->rename(OLDNAME, NEWNAME); $c->open(MAILBOX); $nmsgs = $c->nmsgs; Mail::Cclient::set_callback KEY => CODE, ... $c->list(REF, PAT); # uses "list" callback $c->scan(REF, PAT, CONTENTS); $c->lsub(REF, PAT); $c->subscribe(MAILBOX); $c->unsubscribe(MAILBOX); $c->status(MAILBOX [, FLAG ...]); # uses "status" callback $c->copy(SEQUENCE, MAILBOX [, FLAG ...]); $c->move(SEQUENCE, MAILBOX [, FLAG ...]); $c->append(MAILBOX, MESSAGE [, DATE [, FLAGS]); $arrayref = $c->sort( SORT => ["crit_1", rev_1, ..., "crit_n", rev_n], # (n <= 7) CHARSET => "MIME character", SEARCH => "string", FLAG => [flag_1, ..., flag_n] / "flag" ); $c->search( # uses "searched" callback SEARCH => "string", CHARSET => "MIME character", FLAG => ["flag_1", ..., "flag_n"] / "flag"); $c->search_msg(MSGNO, CRITERIA [, CHARSET]); $arrayref = $c->thread( THREADING => "orderedsubject/references", CHARSET => "MIME character", SEARCH => "string", FLAG => "flag"); $c->ping; $c->check; # uses "log" callback $c->expunge; # uses "expunge" callback $uid = $c->uid(MSGNO); $msgno = $c->msgno(uid); $c->setflag(SEQUENCE, MAILFLAG [, FLAG ...]); $c->clearflag(SEQUENCE, MAILFLAG [, FLAG ...]); $c->gc( [FLAG, ...] ); $c->debug; $c->nodebug; $c->set_sequence(SEQUENCE); $c->uid_set_sequence(SEQUENCE); $result = $c->parameters(PARAM); $c->parameters(PARAM1 => NEWVALUE1 [, PARAM2 => NEWVALUE2 ...]); $c->close; =head2 Mail::Cclient::SMTP API $smtp = Mail::Cclient::SMTP->new( hostlist => [HOSTS] / "HOST", service => SERVICE, port => PORT, options => ["option_1", ..., "option_n"] / "option"); $smtp->mail( transaction => MAILTYPE, defaulthost => HOST, filehandle => FILEHANDLE, envelope => { header => value, ... }, body => {HASHREF} ); $smtp->debug(); $smtp->nodebug(); $smtp->close(); =head2 Utility Functions Mail::Cclient::rfc822_output(HASHREF); $text = Mail::Cclient::rfc822_base64(SOURCE); $text = Mail::Cclient::rfc822_binary(SOURCE); $text = Mail::Cclient::rfc822_qprint(SOURCE); $text = Mail::Cclient::rfc822_8bit(SOURCE); $text = Mail::Cclient::utf8_mime2text(SOURCE); $str = Mail::Cclient::rfc822_date; $str = Mail::Cclient::rfc822_write_address(MAILBOX, HOST, PERSONAL); $str = Mail::Cclient::rfc822_parse_adrlist(ADDRESSES, HOST); =head1 DESCRIPTION C gives access to mailboxes in many different formats (including remote IMAP folders) via the c-client API. The c-client library is the core library used by Pine and the University of Washington IMAP daemon (written by Mark Crispin). The Perl API is mostly taken directly from the underlying c-client library with minor adjustments in places where Perl provides a more natural interface. The primary interface is an object oriented one via the C class but certain methods implicitly use callbacks set via the set_callback function. The c-client library often provides a given piece of functionality by two different function names: one for simple usage under a name of the form C and one with an additional flags arguments under a name of the form C. The corresponding functionality is available from the Perl C class under the single name C. Setting a flag bit such as C in the c-client API is done in Perl by appending an extra argument C<"uid"> to the method call. Arguments to c-client functions which are there only to pass or receive the length of a string argument or result are not present in the Perl API since Perl handles them automatically. Some methods take arguments which refer to a message or messages in a mailbox. An argument denoted MSGNO is a number that refers to a single message. Message 1 refers to the first message in the mailbox, unless the "uid" option is passed as as additional argument in which case the number refers to the uid of the message. An argument denoted SEQUENCE refers to a list of messages and is a string such as '1,3,5-9,12'. Creating a C object and associating a mailstream with it is done with the C<"new"> constructor method (whereas the underlying c-client library uses the C function). =head1 METHODS =head2 Mail::Cclient Object Constructor =over 1 =item new(MAILBOX [, OPTION ...]) Return a new C-Client object. The MAILBOX argument can be anything accepted by the underlying c-client library. This includes the following forms =over 4 =item the special string "INBOX" This is the driver-dependent INBOX folder. =item an absolute filename This specifies a mailbox in the default format (usually Berkeley format for most default library builds) =item a string of the form "{host}folder" or "{host/prot}folder" These refer to an IMAP folder held on host. The "folder" part can be "INBOX" to reference the distinguished INBOX folder that the IMAP protocol defines. The username and password required for logging in to the IMAP server are obtained by using the "login" callback (q.v.). =item a string of the form "#driver.foo/bar/baz" This refers to folder "/bar/baz" which is held in a non-default mailbox format handled by the c-client driver "foo" (e.g. "mbx"). =back =back B The options which can be passed to the C are as follows (taken almost verbatim from the c-client Internal.doc file): =over 9 =item debug Log IMAP protocol telemetry through "debug" callback (q.v.). =item readonly Open mailbox read-only. =item anonymous Don't use or update a .newsrc file for news. =item shortcache Don't cache envelopes or body structures. =item prototype Return the "prototype stream" for the driver associated with this mailbox instead of opening the stream. =item halfopen For IMAP and NNTP names, open a connection to the server but don't open a mailbox. =item expunge Silently expunge the oldstream before recycling. =item secure Don't do non-secure authentication =item tryssl Try SSL first =back =head2 Mailstream fields access B Read-only access to the fields of the underlying mailstream of a C object is supplied by the following methods: =over 11 =item nmsgs Returns the number of messages in the mailbox. =item mailbox Returns the mailbox name. =item rdonly Stream is open read-only. =item anonymous Stream is open with anonymous access. =item halfopen Stream is half-open; it can be reopened or used for functions that don't need a open mailbox such as $c->create() but no message data can be fetched. =item perm_seen, perm_deleted, perm_flagged, perm_answered, perm_draft The relevant flag can be set permanently. =item kwd_create New user flags can be created by referencing them in setflag or clearflag method calls. This can change during a session (e.g. if there is a limit). =item perm_user_flags Returns a list of the user flags which can be set permanently. =item recent Number of recent messages in current mailbox. =item uid_validity The UID validity value. =item uid_last The highest currently assigned UID in the current mailbox. =back =head2 Mailbox Access Methods B You can use the method =over 11 =item open(MAILBOX) to get the mailstream object to open a different mailbox. The cclient library will try to reuse the same IMAP connection where possible in the case of IMAP mailboxes but the host part of the mailbox spec must be given exactly as in the original connection for this to work. =item list(REF, PAT) This method returns a list of mailboxes via the list() callback. REF should normally be just the server specification ("{mailserver:110/imap}"), and PAT (pattern) specifies where in the mailbox hierarchy to start searching. If you want all mailboxes, pass '*' for PAT. There are two special characters you can pass as part of the PAT: "*" and "%". "*" means to return all mailboxes. If you pass PAT as "*", you will get a list of the entire mailbox hierarchy. "%" means to return the current level only. "%" as the PAT parameter will return only the top level mailboxes; "~/mail/%" on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. =item scan(REF, PAT, CONTENTS) This method takes a string to search for in the text of the mailbox. =item lsub(REF, PAT) This method returns a list of subscribed mailboxes via the lsub() callback. =item subscribe(MAILBOX) This method adds the given name to the subscription list. If unsuccessful, an error message is returned via the log() callback. =item unsubscribe(MAILBOX) This method removes the given name from the subscription list. If unsuccessful, an error message is returned via the log() callback. =item create(MAILBOX) This method creates a mailbox with the given name. If unsuccessful, an error message is returned via the log() callback. =item delete(MAILBOX) This method deletes the named mailbox. If unsuccessful, an error message is returned via the log() callback. =item rename(OLDNAME, NEWNAME) This method renames the old mailbox to the new mailbox name. If unsuccessful, an error message is returned via the log() callback. =item status(MAILBOX [, FLAG ...]) This method provides status information about MAILBOX. The information calculated is limited to those mentioned in FLAG arguments and is returned via the "status" callback (q.v.). The FLAG arguments possible are precisely those mentioned in the documentation below for the "status" callback. =item close() This method closes the MAIL stream. =back =head2 Message Data Fetching Methods B The following methods provide access to messages themselves: their headers, structures and the text of their bodies (or parts thereof). =over 10 =item fetch_fast(SEQUENCE) This method causes a cache load of all the "fast" information (internal date, RFC 822 size, and flags) for the given sequence. =item fetch_flags(SEQUENCE) This method causes a fetch of the flags for the given sequence. =item fetch_structure(MSGNO [, FLAG ...] ) This returns the equivalent of what c-client calls an ENVELOPE structure for message MSGNO. If called in an array context then the equivalent of a BODY structure is passed as a second return value. The ENVELOPE structure is in the form of a Perl object of class C. The BODY structure is in the form of a Perl object of class C. See later on for the description of these objects. The flag "B" can be passed which makes the MSGNO argument be interpreted as a message uid. =item fetch_message(MSGNO [, FLAG ...]) This fetch a complete message (headers + body) from an IMAP server (a message uid if the flag "B" is included). =item fetch_header(MSGNO, SECTION [, LINES [, FLAG ...]]) This returns the message header in RFC822 format (as a single string) of message MSGNO (which is interpreted as a message uid if the flag "B" is included). The SECTION specification is a string of integers delimited by period (#.#.#...#) and if is specifed then return only the header section. With no LINES argument, all headers are put into the string. If an array ref argument is passed then it is taken to be a reference to a list of header names. Those headers are the ones that are included in the result, unless the flag "B" is passed in which case all headers are included except those in the list. The flag "B" can be passed to avoid canonicalising the header texts. The flag "B" can be passed to pre-fetch the RFC822.TEXT part of the message at the same time. =item fetch_mime(MSGNO, SECTION [, FLAG ...]) This returns the message text of message MSGNO (which is interpreted as a message uid if the flag "B" is included) or a message text section if a valid SECTION is provided. The body is returned as a MIME single string. The SECTION specification is a string of integers delimited by period (#.#.#...#). The flag "B" can be passed to avoid canonicalising of "internal" format to CRLF newlines. =item fetch_text(MSGNO, SECTION [, FLAG ...]) This returns the body of message MSGNO (a message uid if the flag "B" is included) or a message text section if a valid SECTION is provided. The whole body is returned as a single string with no MIME processing done. Line endings are canonicalised to CRLF unless the "B" flag is included. If the "B" flag is included then the \Seen flag is not actively set (though it may already have been set previously, of course). =item fetch_body(MSGNO, SECTION, [, FLAG ...]) This returns a single (MIME) section of message MSGNO (a message uid if the flag "B" is included). The SECTION argument determines which section is returned and is a string in the form of a dot-separated list of numbers. See the IMAP specification for details. As an example, a multipart/mixed MIME message has sections "1", "2", "3" and so on. If section "3" is multipart/mixed itself, then it has subsections "3.1", "3.2" and so on. The "B" and "B" flags may also be passed and have the same effect as in C documented above. =item uid(MSGNO) Returns the uid associated with message MSGNO. =item elt(MSGNO) This returns the MESSAGECACHE (commonly known as "elt") information associated with message MSGNO as an object in class Mail::Cclient::Elt. See below for what such an object contains. B: for this method to be valid, a previous C or C B have been called on this message. Otherwise, you are into the realms of undefined behaviour and at the mercy of the underlying c-client library. =back =head2 Message Status Manipulation Methods =over 2 =item setflag(SEQUENCE, MAILFLAG [, FLAG ...]) Sets flag MAILFLAG on each message in SEQUENCE (taken to be a sequence of message uids if the "B" flag is passed). The "B" flag causes the local cache not to be updated. =item clearflag(SEQUENCE, MAILFLAG [, FLAG ...]) Clears flag MAILFLAG from each message in SEQUENCE (taken to be a sequence of message uids if the "B" flag is passed). The "B" flag causes the local cache not to be updated. =back =head2 Mailbox Searching/Sort/Thread Methods =over 3 =item search(KEY => VALUE [, KEY1 => VALUE1 ...]) Search for messages satisfying B keyword value. The "searched" callback (q.v.) is called for each matching message. The B keyword value is a string containing a search specification as defined in item SEARCH Command (6.4.4.) of RFC2060 (imap2000/docs/rfc/rfc2060.txt). The B keyword value is like 'ANSWERED TO "malcolm"' or 'FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith"' (See the searching criteria section for details). The B keyword value is a MIME character set to use when searching strings. The B keyword value can be a array reference or a string. Flags: "B" return a message uid's instead of sequence numbers; "B" return the search program to free storage after finishing (internal use only); "B" don't prefetch searched messages. The B keyword/value is not optional. All others keywords are optional. =item sort(KEY => VALUE [, KEY1 => VALUE1 ...]) Returns an array reference of message numbers sorted by the given pairs of parameters (KEY => VALUE). The B keyword value is a array reference, and the argument "crit_1", ..., "crit_n", is a string and can be one of the following: "date", "arrival", "from", "subject", "to", "cc", "size". The argument rev_1, ... rev_n is 0 or 1 if reverse sorting. The B keyword value is a MIME character set to use when sorting strings. The B keyword value is a string like, ALL, SEEN, UNSEEN, ANSWERED, UNANSWERED, FLAGGED, UNFLAGGED, SEARCHED or like SEARCH keyword in search method and return only messages that meet specified search criteria (See the searching criteria section for details). The B keyword value can be a array reference or a string. Flags: "B" return uid's instead of sequence numbers; "B" return the search program to free storage after finishing (internal use only); "B" don't prefetch searched messages; "B" return the sort program to free storage after finishing (internal use only). The B keyword/value is not optional. All others keywords are optional. =item thread(KEY => VALUE [, KEY1 => VALUE1 ...]) This method returns a array reference of message sequence numbers and/or lists of lists of message numbers. The B keyword value can take one of following strings values: "B" or "B". The "B" algorithm sorts by subject with a secondary sort of message date, and then for sets of messages with identical subjects. The "B" algorithm threads the searched messages by grouping them together in parent/child relationships based on which messages are replies to others. The B keyword value is a MIME character set to use when searching strings. The B keyword value accepts a string ala search() method. The B keyword value is a string. Flags: "B" return a message uid's instead of sequence numbers. All keywords are optional. If you don't use any keyword, in that case the default value is "B". Example: ARRAYREF = [2, [3, 6, [4, 23], [44, 7, 96]] =back =head2 Miscellaneous Mailbox and Message Methods The following are miscellaneous methods. =over 3 =item ping Checks where the mailstream is still alive: used as a keep-alive and to check for new mail. =item check Performs a (driver-dependent) checkpoint of the mailstream (B a check for new mail). Information about the checkpoint is passed to the "log" callback (q.v.). =item expunge Expunges all message marked as deleted in the mailbox. Calls the "expunged" callback (q.v.) on each such message and logging information is passed to the "log" callback. Decrementing message numbers happens after each and every message is expunged. As the example in the c-client documentation for mail_expunge says, if three consecutive messages starting at msgno 5 are expunged, the "expunged" callback will be called with a msgno of 5 three times. =back B A message may be copied or moved into another mailbox with the methods C and C. These methods only allow the destination mailbox to be of the same type as (and on the same host as) the mailstream object on which the methods are called. =over 2 =item copy(MSGNO, MAILBOX [, FLAGS]) This copies message MSGNO (a message uid if the "B" flag is included) to mailbox MAILBOX. If the "B" flag is included then the message is actually moved instead (for compatibility with the CP_MOVE flag of the underlying c-client C function). =item move(MSGNO, MAILBOX [, FLAGS]) This moved message MSGNO (a message uid if the "B" flag is included) to mailbox MAILBOX. =back =over 2 =item append(MAILBOX, MESSAGE [, DATE [, FLAGS]) Append a raw message (MESSAGE is an ordinary string) to MAILBOX, giving it an optional date and FLAGS (again, simply strings). =item gc( [FLAG, ...] ) Garbage collects the cache for the mailstream. The FLAG arguments, "B", "B", "B", determine what is garbage collected. =back =head2 Utility Methods =over 7 =item debug Enables debugging for the mailstream, logged via the "dlog" callback (q.v.). =item nodebug Disables debugging for the mailstream. =item set_sequence(SEQUENCE) Sets the sequence bit for each message in SEQUENCE (and turns it off for all other messages). This has been renamed for Perl from the underlying c-client function C to avoid clashing with the sequence field member of the mailstream object. =item uid_set_sequence(SEQUENCE) Sets the sequence bit for each message referenced by uid in SEQUENCE (and turns it off for all other messages). This has been renamed for Perl from the underlying c-client function C for consistency with C above. =item search_msg(MSGNO, CRITERIA [, CHARSET]) It inspects the message B on that stream to see if it matches the B or not. If it matches, 1 is returned, else 0. =item msgno(UID) Returns the msgno associated with message UID. =item parameters(PARAM [, => NEWVALUE [, PARAM2 => NEWVALUE2 ...]]) With a single argument, gets the current value of parameter PARAM. With one or more pairs of PARAM => VALUE arguments, sets those PARAM values to the given new values. PARAM can be one of the following strings: USERNAME, HOMEDIR, LOCALHOST, SYSINBOX, OPENTIMEOUT, READTIMEOUT, WRITETIMEOUT, CLOSETIMEOUT, RSHTIMEOUT, SSHTIMEOUT, SSLFAILURE, MAXLOGINTRIALS, LOOKAHEAD, IMAPPORT, PREFETCH, CLOSEONERROR, POP3PORT, UIDLOOKAHEAD, MBXPROTECTION, DIRPROTECTION, LOCKPROTECTION, FROMWIDGET, NEWSACTIVE, NEWSSPOOL, NEWSRC, DISABLEFCNTLLOCK, LOCKEACCESERROR, LISTMAXLEVEL, ANONYMOUSHOME. =back =head2 Mail::Cclient::SMTP Object Constructor =over 5 =item new(KEY => VALUE [, KEY1 => VALUE1 ...]) Creates the SMTP object and opens an SMTP connection to a one of the hosts in the B and if successful returns a stream suitable for use by the other SMTP methods. The B keyword/value is not optional. All others keywords are optional. The following SMTP open options are available: * debug - Debug protocol negotiations. If "debug" is defined, protocol telemetry is logged via mm_dlog(). * dsn - DSN notification, none set mean NEVER * dsn_notify_failure * dsn_notify_delay * dsn_notify_success - DSN return full msg vs. header * dsn_return_full * 8bitmime - 8-bit MIME requested * secure - Don't do non-secure authentication * tryssl - Try SSL first * tryalt - Old name for tryssl =item mail(OPTION => VALUE, ...) The options which can be passed to the mail are as follows =over 5 =item transaction => "string value" This option set the type of SMTP transaction (one of "MAIL", "SEND", "SAML", or "SOML") to deliver the specified message. =item defaulthost => "string value" Default host name if an address lacks an @host. =item filehandle => HANDLE Filehandle to write output message described with the given envelope and body. =item envelope => { header => value, ... } The following headers are available for envelope message: from, to, cc, bcc, sender, reply_to, return_path, in_reply_to, message_id, subject, remail, date, newsgroups, followup_to, references =item body => { option => value, ... } The following fields are available for body message: =over 12 =item content_type The content_type is a string like "type/subtype". Type is the MIME type of the message. For example, text, multipart, message, application, audio, image, video, model, ... Subtype is the MIME subtype of the message. For example, PLAIN, HTML, MIXED, RELATED, or ALTERNATIVE. =item encoding Encoding of a single part message or the body of a multipart message. The MIME encoding can be one of the following strings: 7bit, 8bit, binary, base64, quoted-printable. =item part => [{part1}, {part2}, ...] For MIME type multipart messages =item disposition => [{type => "inline/attachment"}, [parameter]] The content disposition of the body: a reference to a list consisting of the disposition type followed by a (possibly empty) list of parameter. =item parameter => [{attribute => attr_val1 }, {value => val_val1}, ...] List of hash references. =item description The MIME description of the body part. =item language => ["en", "pt", ...] body language list reference (header "Content-Language: "). =item location body content URI (header "Content-Location: "). =item id The message ID (header "Content-ID: ") =item md5 The MD5 checksum of the body (header "Content-MD5: "). =item data Message data of part body. =item path Pathname of file to attach. For example "/usr/local/images/image.jpg". If you use data in hash then don't use path. =back =back =item close() This method closes the SMTP stream. =item debug This method enables SMTP protocol telemetry logging for this stream. All SMTP protocol operations are passed to the application via the dlog() facility. =item nodebug This method disables SMTP protocol telemetry =back =head1 UTILITY FUNCTIONS (RFC 822 Support Functions) The following are utility functions (not methods). =over 9 =item Mail::Cclient::rfc822_base64(SOURCE) Returns the SOURCE text converted to base64 format. =item Mail::Cclient::rfc822_binary(SOURCE) Convert binary contents to base64 =item Mail::Cclient::rfc822_qprint(SOURCE) Returns the SOURCE text converted to quoted printable format. =item Mail::Cclient::rfc822_8bit(SOURCE) Convert 8bit contents to quoted-printable text =item Mail::Cclient::utf8_mime2text(SOURCE) Returns the MIME-2 SOURCE text converted to UTF-8. =item Mail::Cclient::rfc822_date() Returns the current date in RFC822 format. =item Mail::Cclient::rfc822_write_address(MAILBOX, HOST, PERSONAL) This function return an RFC 822 format address string based on the information from MAILBOX, HOST and PERSONAL. =item Mail::Cclient::rfc822_parse_adrlist(ADDRESSES, HOST) This function parses the string of ADDRESSES into an address list array ref. Any addresses missing a host name are have the host name defaulted from the HOST argument. Any parsing errors are noted via the log() callback. =item Mail::Cclient::rfc822_output(HASHREF) This function writes the message described with the given envelope and body. The options which can be passed to the rfc822_output are as follows: =over 4 =item defaulthost => "string" =item filehandle => HANDLE =item envelope => { header => value, ... } =item body => { option => value, ... } =back =back =head1 CALLBACKS Certain methods mentioned above use callbacks to pass or receive extra information. Each callback has a particular name (e.g. "log", "dlog", "list", "login") and can be associated with a particular piece of Perl code via the C function (available for export by the C class). The C function takes pairs of arguments NAME, CODE for setting callback NAME to be the given CODE, a subroutine reference. The only callback which is required to be set and the only callback whose return value matters is the "login" callback (only used when the "new" method constructs an IMAP mailstream). Apart from that case, callbacks which have not been set are ignored. A callback set to undef is also ignored. =over 15 =item searched(STREAM, MSGNO) This callback is invoked for each message number satifying the CRITERIA of the "search" method, defined above. =item exists(STREAM, MSGNO) =item expunged(STREAM, MSGNO) =item flags(STREAM, MSGNO) =item notify(STREAM, STRING, ERRFLAG) =item list(STREAM, DELIMITER, MAILBOX [, ATTR ...]) =item lsub(STREAM, DELIMITER, MAILBOX [, ATTR ...]) =item status(STREAM, MAILBOX, [, ATTR, VALUE] ...) Attribute values passed can be "messages", "recent", "unseen", "uidvalidity", "uidnext". =item log(STRING, ERRFLAG) =item dlog(STRING) =item fatal(STRING) =item login(NETMBXINFO, TRIAL) The "login" callback is invoked when the c-client library is opening an IMAP mailstream and needs to find out the username and password required. This callback must return precisely two values in the form (USERNAME, PASSWORD). TRIAL is the number of the current login attempt (starting at 1). NETMBXINFO is a hash reference with the following keys: =over 11 =item host The hostname of the IMAP server. =item user The username requested. =item mailbox The mailbox name requested. =item service =item port =item anoflag Set to 1 if anonymous access has been requested otherwise this key is not created at all. =item dbgflag Set to 1 if debugging access has been requested otherwise this key is not created at all. =item secflag Set to 1 if secure access has been requested otherwise this key is not created at all. =item sslflag =item trysslflag =item novalidate =back =item critical(STREAM) =item nocritical(STREAM) =item diskerror(STREAM, ERRCODE, SERIOUS) =back =head1 ENVELOPES, BODIES, ADDRESSES and ELTS The results of the C and C methods involve objects in the classes C, C, C and C. These will be referred to as Envelope, Body, Address and Elt objects respectively. These objects are all "read-only" and only have methods for picking out particular fields. =head2 Address objects An Address object represents a single email address and has the following fields, available as methods or, if Perl 5.005 or later is being used, as pseudo-hash keys. =over 5 =item personal The personal phrase of the address (i.e. the part contained in parentheses or outside the angle brackets). =item adl The at-domain-list or source route (not usually used). =item mailbox The mailbox name (i.e. the part before the @ which is usually a username or suchlike). =item host The hostname (i.e. the part after the @). =item error Only set if the address has delivery errors when C is called. Since that function hasn't been implemented in the Perl module yet, this isn't any use. =back =head2 Envelope objects An Envelope object represents a structured form of the header of a message. It has the following fields, available as methods or, if Perl 5.005 or later is being used, as pseudo-hash keys. =over 2 =item remail, date, subject, in_reply_to, message_id, newsgroups, followup_to, references, These are all strings. =item return_path, from, sender, reply_to, to, cc, bcc These are all references to lists which contain one or more Address objects. =back =head2 Body objects A Body object represents the structure of a message body (not its contents).It has the following fields, available as methods or, if Perl 5.005 or later is being used, as pseudo-hash keys. =over 12 =item type The MIME type (as a string) of the message (currently in uppercase as returned from the c-client library). For example, "TEXT" or "MULTIPART". =item encoding The MIME encoding (as a string) of the message. =item subtype The MIME subtype (as a string) of the message. For example, "PLAIN", "HTML" or "MIXED". =item parameter A reference to a list of MIME parameter key/value pairs. =item id The message ID. =item description The MIME description of the body part. =item nested If (and only if) the body is of MIME type multipart, then this field is a reference to a list of Body objects, each representing one of the sub parts of the message. If (and only if) the body is of MIME type message/rfc822, then this field is a reference to a list of the form (ENVELOPE, BODY) which are, respectively, the Body and Envelope objects referring to the encapsulated message. If the message is not of MIME type multipart or message/rfc822 then this field is undef. =item lines The size in lines of the body. =item bytes The size in bytes of the body. =item md5 The MD5 checksum of the body. =item disposition The content disposition of the body: a reference to a list consisting of the disposition type followed by a (possibly empty) list of parameter key/value pairs. =back =head2 Elt objects These have fields containing flag information for a given message, along with internal date information and the RFC822 message size. =over 4 =item msgno The message number. =item date This contains the internal date information (spread about a series of bitfields in the underlying c-client library C structure) in the form of a string: yyyy-mm-dd hh:mm:ss [+-]hhmm =item flags A reference to a list of flags associated with the message. The flags are in the forms of their RFC2060 names (e.g. \Deleted, \Seen) for official flags and the user-chosen name for user-defined flags. =item rfc822_size The RFC822 size of the message. =item imapdate This contains the internal date information (spread about a series of bitfields in the underlying c-client library C structure) in the form of a string: dd-mmm-yyyy hh:mm:ss [+-]hhmm This form is needed by IMAP servers. =back =head1 SEARCHING CRITERIA Searching criteria consist of one or more search keys. When multiple keys are specified, the result is the intersection (AND function) of all the messages that match those keys. A search key can also be a parenthesized list of one or more search keys. In all search keys that use strings, a message matches the key if the string is a substring of the field. The matching is case-insensitive. The defined search keys are as follows. =over 36 =item Messages with message sequence numbers corresponding to the specified message sequence number set. =item ALL All messages in the mailbox; the default initial key for ANDing. =item ANSWERED Messages with the B<\Answered> flag set. =item BCC Messages that contain the specified string in the envelope structure's BCC field. =item BEFORE Messages whose internal date is earlier than the specified date. =item BODY Messages that contain the specified string in the body of the message. =item CC Messages that contain the specified string in the envelope structure's CC field. =item DELETED Messages with the B<\Deleted> flag set. =item DRAFT Messages with the B<\Draft> flag set. =item FLAGGED Messages with the B<\Flagged> flag set. =item FROM Messages that contain the specified string in the envelope structure's FROM field. =item HEADER Messages that have a header with the specified field-name (as defined in [RFC-822]) and that contains the specified string in the [RFC-822] field-body. =item KEYWORD Messages with the specified keyword set. =item LARGER Messages with an [RFC-822] size larger than the specified number of octets. =item NEW Messages that have the B<\Recent> flag set but not the B<\Seen> flag. This is functionally equivalent to "(RECENT UNSEEN)". =item NOT Messages that do not match the specified search key. =item OLD Messages that do not have the B<\Recent> flag set. This is functionally equivalent to "NOT RECENT" (as opposed to "NOT NEW"). =item ON Messages whose internal date is within the specified date. =item OR Messages that match either search key. =item RECENT Messages that have the B<\Recent> flag set. =item SEEN Messages that have the B<\Seen> flag set. =item SENTBEFORE Messages whose [RFC-822] Date: header is earlier than the specified date. =item SENTON Messages whose [RFC-822] Date: header is within the specified date. =item SENTSINCE Messages whose [RFC-822] Date: header is within or later than the specified date. =item SINCE Messages whose internal date is within or later than the specified date. =item SMALLER Messages with an [RFC-822] size smaller than the specified number of octets. =item SUBJECT Messages that contain the specified string in the envelope structure's SUBJECT field. =item TEXT Messages that contain the specified string in the header or body of the message. =item TO Messages that contain the specified string in the envelope structure's TO field. =item UID Messages with unique identifiers corresponding to the specified unique identifier set. =item UNANSWERED Messages that do not have the B<\Answered> flag set. =item UNDELETED Messages that do not have the B<\Deleted> flag set. =item UNDRAFT Messages that do not have the B<\Draft> flag set. =item UNFLAGGED Messages that do not have the B<\Flagged> flag set. =item UNKEYWORD Messages that do not have the specified keyword set. =item UNSEEN Messages that do not have the B<\Seen> flag set. =back =head1 CAVEATS This CAVEATS section was contributed by Bruce Gingery . The Mail::Cclient::B method returns the actual full path opened, which may not give an accurate string comparison with the mailbox that was requested to be opened. This is especially true with remote mailboxes. The C-Client library is VERY intolerant of logic errors, and does not automatically garbage collect. Use the C method as it makes sense for your application. Some POP3 servers B This is not a malfunction in either the C-Client code nor the Mail::Cclient modules. The C method can be used to extend a C connection (e.g. use the same c-client instance to read a mailbox that was previously halfopened for a list of mailboxes. This may or may not be a good idea, depending upon your needs. It does, however, eliminate the problem of opening multiple connections, such as has been noted in Netscape 4.x mail handling, and which plagues some servers badly. It may be better, however, to C the connection used for C, and re-instantiate to process the mailbox. C-Client may not support headers you need for send. Note that other modules I be used in place of sending with the c-client. These include Net::SMTP, local invocation of piped sendmail (or other E-mail insertion software), or sendto: URLs under libwww POST. C information for remote mailboxes is server dependent, as well. You may or may not get rfc822_size in elt returns, for example. Multiple c-client instances open simultaneously may not work as expected. =head1 AUTHOR Malcolm Beattie, mbeattie@sable.ox.ac.uk. Maintained by Henrique Dias, hdias@aesbuc.pt. =head1 VERSION version 1.12 =head1 SEE ALSO perl(1) IMAP::Admin Mail::Send =cut Mail-Cclient-1.12/criteria.h0000644000076400007640000000176707363267761016351 0ustar wwwadminweb00000000000000/* * Program: Mailbox Access routines * Extension of mail_criteria function * * Author: Helena Gomes * Date: 18 July 2001 * Last Edited: 15 October 2001 * * Parts of code from sources of c-client and imap (Mark Crispin) * Copyright 2001 University of Washington. */ SEARCHPGM *make_criteria(char *criteria); long _parse_criterion(SEARCHPGM *pgm, char **arg, unsigned long maxmsg, unsigned long maxuid, unsigned long depth); long _parse_criteria(SEARCHPGM *pgm, char **arg, unsigned long maxmsg, unsigned long maxuid, unsigned long depth); long _crit_number(unsigned long *number, char **arg); long _crit_set(SEARCHSET **set, char **arg, unsigned long maxima); long _crit_string(STRINGLIST **string, char **arg); char *_parse_astring(char **arg, unsigned long *size, char *del); long _crit_date(unsigned short *date, char **arg); long _crit_date_work(unsigned short *date, char **arg); void _inliteral(char *s, unsigned long n); void _slurp(char *s, int n); Mail-Cclient-1.12/Cclient.pm0000644000076400007640000000674110132016170016260 0ustar wwwadminweb00000000000000# # Cclient.pm # Last Edited: Sat Oct 9 18:14:12 WEST 2004 # # Copyright (c) 1998 - 2004 Malcolm Beattie # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # package Mail::Cclient; use DynaLoader; use Exporter; use strict; use vars qw($VERSION @ISA @EXPORT_OK %_callback); $VERSION = "1.12"; @ISA = qw(Exporter DynaLoader); @EXPORT_OK = qw(set_callback get_callback rfc822_base64 rfc822_binary rfc822_qprint rfc822_8bit utf8_mime2text rfc822_date rfc822_parse_adrlist rfc822_write_address rfc822_output); { package Mail::Cclient::Address; use vars qw(%FIELDS); %FIELDS = ( personal => 1, adl => 2, mailbox => 3, host => 4, error => 5); sub personal { shift->[1] } sub adl { shift->[2] } sub mailbox { shift->[3] } sub host { shift->[4] } sub error { shift->[5] } } { package Mail::Cclient::Body; use vars qw(%FIELDS); %FIELDS = ( type => 1, encoding => 2, subtype => 3, parameter => 4, id => 5, description => 6, nested => 7, language => 8, location => 9, lines => 10, bytes => 11, md5 => 12, disposition => 13); sub type { shift->[1] } sub encoding { shift->[2] } sub subtype { shift->[3] } sub parameter { shift->[4] } sub id { shift->[5] } sub description { shift->[6] } sub nested { shift->[7] } sub language { shift->[8] } sub location { shift->[9] } sub lines { shift->[10] } sub bytes { shift->[11] } sub md5 { shift->[12] } sub disposition { shift->[13] } } { package Mail::Cclient::Envelope; use vars qw(%FIELDS); %FIELDS = ( remail => 1, return_path => 2, date => 3, from => 4, sender => 5, reply_to => 6, subject => 7, to => 8, cc => 9, bcc => 10, in_reply_to => 11, message_id => 12, newsgroups => 13, followup_to => 14, references => 15); sub remail { shift->[1] } sub return_path { shift->[2] } sub date { shift->[3] } sub from { shift->[4] } sub sender { shift->[5] } sub reply_to { shift->[6] } sub subject { shift->[7] } sub to { shift->[8] } sub cc { shift->[9] } sub bcc { shift->[10] } sub in_reply_to { shift->[11] } sub message_id { shift->[12] } sub newsgroups { shift->[13] } sub followup_to { shift->[14] } sub references { shift->[15] } } { package Mail::Cclient::Elt; use vars qw(%FIELDS); %FIELDS = ( msgno => 1, date => 2, flags => 3, rfc822_size => 4, imapdate => 5); sub msgno { shift->[1] } sub date { shift->[2] } sub flags { shift->[3] } sub rfc822_size { shift->[4] } sub imapdate { shift->[5] } } # Our own methods sub new { my $class = shift; return Mail::Cclient::open(undef, @_); } sub set_callback { while (@_) { my $name = shift; my $value = shift; $_callback{$name} = $value; } } sub get_callback { my $name = shift; return $_callback{$name}; } sub gc { my $obj = shift; $obj = undef unless ref($obj); $obj->real_gc; } sub parameters { my $stream = shift; # XXX Ignore stream for now if (@_ == 1) { return _parameters(undef, @_); } elsif (@_ % 2) { require Carp; Carp::croak("Mail::Cclient::parameters takes one argument or pairs"); } while (my ($param, $value) = splice(@_, 0, 2)) { _parameters(undef, $param, $value); } return 1; } sub Mail::Cclient::SMTP::new { my $class = shift; return Mail::Cclient::SMTP::open_full("Mail::Cclient::SMTP", @_); } bootstrap Mail::Cclient; 1; Mail-Cclient-1.12/Artistic0000444000076400007640000001373706514660262016067 0ustar wwwadminweb00000000000000 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Mail-Cclient-1.12/README0000644000076400007640000001140710132021604015212 0ustar wwwadminweb00000000000000 Perl Mail::Cclient module, Version 1.12 Copyright (c) 1998 - 2004, Malcolm Beattie This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with this kit. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details. You should have received a copy of the Artistic License with this kit, in the file named "Artistic". If not, you can get one from the Perl distribution. You should also have received a copy of the GNU General Public License, in the file named "Copying". If not, you can get one from the Perl distribution or else write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. DESCRIPTION Mail::Cclient gives access to mailboxes in many different formats (including remote IMAP folders) via the c-client API. The c-client library is the core library used by Pine and the University of Washington IMAP daemon (written by Mark Crispin). PREREQUISITES If you use RedHat please install the following rpm's: imap-devel-xxx.xxx.rpm krb5-devel-xxx.xxx.rpm openssl-devel-xxx.xxx.rpm pam-devel-xxx.xxx.rpm INSTALLATION Minumum instruction (Gentoo) # emerge mit-krb5 # emerge uw-imap perl Makefile.PL \ --with-shared_cclient \ --with-kerberos=/usr/lib \ --with-pam \ --with-ssl \ --with-cclient-includes=/usr/include/imap make make test make install (RedHat 8.0, 9 and Fedora Core 1): perl Makefile.PL \ --with-shared_cclient \ --with-kerberos=/usr/kerberos/lib \ --with-pam \ --with-ssl \ --with-cclient-includes=/usr/include/imap make make test make install Build static library without OpenSSL (Gentoo) tar xvfz Mail-Cclient-1.12.tar.gz tar xvfz imap-2004a.tar.Z cd imap-2004a make slx SSLTYPE=none (if x86_64-linux - AMD64: make slx SSLTYPE=none EXTRACFLAGS=-fPIC) cd ../Mail-Cclient-1.12 perl Makefile.PL --cclient_dir=../imap-2004a/c-client --with-pam make make test make install (RedHat 8.0, 9 and Fedora Core 1): tar xvfz Mail-Cclient-1.12.tar.gz tar xvfz imap-2004a.tar.Z cd imap-2004a make lrh SSLTYPE=none cd ../Mail-Cclient-1.12 perl Makefile.PL --cclient_dir=../imap-2004a/c-client --with-pam make make test make install A little advanced instruction: Install the University of Washington imapd source distribution (e.g. version imap-2004a.tar.Z or above) and build at least the c-client library (c-client/c-client.a). The home site for the UW imapd is ftp://ftp.cac.washington.edu/imap/imap-2004a.tar.Z If your platform needs any additional LIBS entries, edit Makefile.PL and add them. Do c-client shared library perl Makefile.PL --with-shared_cclient make make test c-client static library perl Makefile.PL --cclient_dir=/path/to/c-client Options: --cclient_dir=/path/to/c-client --with-shared_cclient --with-pam=/path/to/libs (support for PAM) --with-ssl=/path/to/libs (support for SSL) --with-kerberos=/path/to/libs (support for Kerberos) --with-cclient-includes=/path/to/imap_includes --help where /path/to/c-client is the pathname of the directory which contains the c-client.a archive library which you have just built. If you want to add any additional MakeMaker options then edit the file Makefile.PL and add them in WriteMakefile. This process needs to extract all object files from the c-client.a archive into the current directory. This is for the sake of those platforms which require an explicit list of object files for creating shared objects rather than a mix of .o and .a files. If the extraction succeeds, it will say so and you can carry on and do make make test If the extraction failed for some reason, you will have to do that part yourself and then replace that part of MakeMaker with a simple assignment to @objects of the object files in your c-client.a. Once the extension has been built, you can do make install to complete the installation. DOCUMENTATION Cclient.pm includes fairly complete documentation which the build/installation process will turn into a man page. You may also want to read the $CCLIENT_DIR/docs/Internal.doc which documents the underlying c-client library. However, that documentation is at odds with the actual code in a few places. Malcolm Beattie 31 Oct 2000 Version 1.12 submitted by Henrique Dias Questions, bug reports, useful code bits, and suggestions for Mail-Cclient-1.12 should just be sent to me at hdias@aesbuc.pt Henrique Dias 09 Oct 2004 Mail-Cclient-1.12/Copying0000444000076400007640000003030706514660234015704 0ustar wwwadminweb00000000000000 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! Mail-Cclient-1.12/FAQ0000644000076400007640000000247707670376577014736 0ustar wwwadminweb00000000000000 Mail::Cclient Troubleshooting FAQ 1) Can't load 'blib/arch/auto/Mail/Cclient/Cclient.so' for module Mail::Cclient: blib/arch/auto/Mail/Cclient/Cclient.so: undefined symbol: pam_end at /usr/lib/perl5/5.6.0/i386-linux/DynaLoader.pm line 169. Add option --with-pam 2) criteria.c:16: mail.h: No such file or directory criteria.c:17: misc.h: No such file or directory Add option --with-cclient-includes=/path/to/imap_includes (RedHat 6.2 --with-cclient-includes=/usr/include/imap) 3) Can't load 'blib/arch/auto/Mail/Cclient/Cclient.so' for module Mail::Cclient: blib/arch/auto/Mail/Cclient/Cclient.so: undefined symbol: krb5_defkeyname at /usr/lib/perl5/5.6.0/i386-linux/DynaLoader.pm line 169. Add option --with-kerberos (RedHat 6.2 --with-kerberos=/usr/kerberos/lib) 4) Can't load 'blib/arch/auto/Mail/Cclient/Cclient.so' for module Mail::Cclient: blib/arch/auto/Mail/Cclient/Cclient.so: undefined symbol: SSL_CTX_set_tmp_rsa_callback at /usr/lib/perl5/5.6.0/i386-linux/DynaLoader.pm line 169. Add option --with-ssl 5) Certificate failure for localhost: self signed certificate: /C=--/ST=SomeState/L=SomeCity/O=SomeOrganization/ OU=SomeOrganizationalUnit/CN=localhost.localdomain/emailAddress= root@localhost.localdomain Install imap without ssl: make lrh SSLTYPE=none Mail-Cclient-1.12/META.yml0000644000076400007640000000045310132021657015612 0ustar wwwadminweb00000000000000# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Mail-Cclient version: 1.12 version_from: Cclient.pm installdirs: site requires: distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17 Mail-Cclient-1.12/criteria.c0000644000076400007640000002574307535154500016327 0ustar wwwadminweb00000000000000/* * Program: Mailbox Access routines * Extension of mail_criteria function * * Author: Helena Gomes * Date: 18 July 2001 * Last Edited: Tue Sep 3 12:45:33 WEST 2002 * * Parts of code from sources of c-client (Mark Crispin) * Copyright 2001 University of Washington. */ #include #include #include #include "mail.h" #include "misc.h" #include "criteria.h" #define LITSTKLEN 20 #define MAXCLIENTLIT 10000 #define TMPLEN 8192 int litsp = 0; char *litstk[LITSTKLEN]; char cmdbuf[TMPLEN]; long _parse_criteria(SEARCHPGM *pgm, char **arg, unsigned long maxmsg, unsigned long maxuid, unsigned long depth) { if(arg && *arg) { do if(!_parse_criterion(pgm, arg, maxmsg, maxuid, depth)) return NIL; while (**arg == ' ' && (*arg)++); if(**arg && **arg != ')') return NIL; } return T; } long _parse_criterion(SEARCHPGM *pgm, char **arg, unsigned long maxmsg, unsigned long maxuid, unsigned long depth) { unsigned long i; char c = NIL, *s, *t, *v, *tail, *del; SEARCHSET **set; SEARCHPGMLIST **not; SEARCHOR **or; SEARCHHEADER **hdr; long ret = NIL; if((depth > 50) || !(arg && *arg)); else if(**arg == '(') { (*arg)++; if(_parse_criteria(pgm, arg, maxmsg, maxuid, depth+1) && **arg == ')') { (*arg)++; ret = T; } } else { if(!(tail = strpbrk((s = *arg)," )"))) tail = *arg + strlen (*arg); c = *(del = tail); *del = '\0'; switch(*ucase(s)) { case '*': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if(*(set = &pgm->msgno)) { for(not = &pgm->not; *not; not = &(*not)->next); *not = mail_newsearchpgmlist(); set = &((*not)->pgm->not = mail_newsearchpgmlist())->pgm->msgno; } ret = _crit_set(set, &s, maxmsg) && (tail == s); break; case 'A': /* possible ALL, ANSWERED */ if(!strcmp(s+1,"LL")) ret = T; else if(!strcmp(s+1,"NSWERED")) ret = pgm->answered = T; break; case 'B': /* possible BCC, BEFORE, BODY */ if(!strcmp(s+1,"CC") && c == ' ' && *++tail) ret = _crit_string(&pgm->bcc,&tail); else if(!strcmp(s+1,"EFORE") && c == ' ' && *++tail) ret = _crit_date(&pgm->before,&tail); else if(!strcmp(s+1,"ODY") && c == ' ' && *++tail) ret = _crit_string(&pgm->body,&tail); break; case 'C': /* possible CC */ if(!strcmp(s+1,"C") && c == ' ' && *++tail) ret = _crit_string(&pgm->cc,&tail); break; case 'D': /* possible DELETED */ if(!strcmp(s+1,"ELETED")) ret = pgm->deleted = T; if(!strcmp(s+1,"RAFT")) ret = pgm->draft = T; break; case 'F': /* possible FLAGGED, FROM */ if(!strcmp(s+1,"LAGGED")) ret = pgm->flagged = T; else if(!strcmp(s+1,"ROM") && c == ' ' && *++tail) ret = _crit_string(&pgm->from,&tail); break; case 'H': /* possible HEADER */ if(!strcmp(s+1,"EADER") && c == ' ' && *(v = tail + 1) && (s = _parse_astring(&v, &i, &c)) && i && c == ' ' && (t = _parse_astring (&v, &i, &c))) { for(hdr = &pgm->header; *hdr; hdr = &(*hdr)->next); *hdr = mail_newsearchheader(s,t); *(tail = v ? v - 1 : t + i) = c; ret = T; } break; case 'K': /* possible KEYWORD */ if(!strcmp(s+1,"EYWORD") && c == ' ' && *++tail) ret = _crit_string (&pgm->keyword,&tail); break; case 'L': /* possible LARGER */ if(!strcmp(s+1,"ARGER") && c == ' ' && *++tail) ret = _crit_number(&pgm->larger,&tail); break; case 'N': /* possible NEW, NOT */ if(!strcmp(s+1,"EW")) ret = pgm->recent = pgm->unseen = T; else if(!strcmp(s+1,"OT") && c == ' ' && *++tail) { for(not = &pgm->not; *not; not = &(*not)->next); *not = mail_newsearchpgmlist(); ret = _parse_criterion((*not)->pgm, &tail, maxmsg, maxuid, depth+1); } break; case 'O': /* possible OLD, ON */ if(!strcmp(s+1,"LD")) ret = pgm->old = T; else if(!strcmp(s+1,"N") && c == ' ' && *++tail) ret = _crit_date(&pgm->on,&tail); else if(!strcmp(s+1,"R") && c == ' ') { for(or = &pgm->or; *or; or = &(*or)->next); *or = mail_newsearchor(); ret = *++tail && _parse_criterion((*or)->first,&tail,maxmsg,maxuid,depth+1) && *tail == ' ' && *++tail && _parse_criterion((*or)->second,&tail,maxmsg,maxuid,depth+1); } break; case 'R': /* possible RECENT */ if(!strcmp (s+1,"ECENT")) ret = pgm->recent = T; break; case 'S': /* possible SEEN, SINCE, SUBJECT */ if(!strcmp(s+1,"EEN")) ret = pgm->seen = T; else if(!strcmp(s+1,"ENTBEFORE") && c == ' ' && *++tail) ret = _crit_date(&pgm->sentbefore,&tail); else if(!strcmp(s+1,"ENTON") && c == ' ' && *++tail) ret = _crit_date(&pgm->senton,&tail); else if(!strcmp(s+1,"ENTSINCE") && c == ' ' && *++tail) ret = _crit_date(&pgm->sentsince,&tail); else if(!strcmp(s+1,"INCE") && c == ' ' && *++tail) ret = _crit_date(&pgm->since,&tail); else if(!strcmp(s+1,"MALLER") && c == ' ' && *++tail) ret = _crit_number(&pgm->smaller,&tail); else if(!strcmp(s+1,"UBJECT") && c == ' ' && *++tail) ret = _crit_string(&pgm->subject,&tail); break; case 'T': /* possible TEXT, TO */ if(!strcmp(s+1,"EXT") && c == ' ' && *++tail) ret = _crit_string(&pgm->text, &tail); else if(!strcmp(s+1,"O") && c == ' ' && *++tail) ret = _crit_string(&pgm->to, &tail); break; case 'U': /* possible UID, UN* */ if(!strcmp(s+1,"ID") && c== ' ' && *++tail) { if(*(set = &pgm->uid)) { for(not = &pgm->not; *not; not = &(*not)->next); *not = mail_newsearchpgmlist(); set = &((*not)->pgm->not = mail_newsearchpgmlist ())->pgm->uid; } ret = _crit_set(set, &tail, maxuid); } else if(!strcmp(s+1,"NANSWERED")) ret = pgm->unanswered = T; else if(!strcmp(s+1,"NDELETED")) ret = pgm->undeleted = T; else if(!strcmp(s+1,"NDRAFT")) ret = pgm->undraft = T; else if(!strcmp(s+1,"NFLAGGED")) ret = pgm->unflagged = T; else if(!strcmp(s+1,"NKEYWORD") && c == ' ' && *++tail) ret = _crit_string(&pgm->unkeyword, &tail); else if(!strcmp(s+1,"NSEEN")) ret = pgm->unseen = T; break; default: break; } if(ret) { *del = c; *arg = tail; } } return ret; } long _crit_date(unsigned short *date, char **arg) { if(**arg != '"') return _crit_date_work(date, arg); (*arg)++; if(!(_crit_date_work(date,arg) && (**arg == '"'))) return NIL; (*arg)++; return T; } long _crit_date_work(unsigned short *date, char **arg) { int d,m,y; if(isdigit(d = *(*arg)++) || ((d == ' ') && isdigit(**arg))) { if(d == ' ') d = 0; else d -= '0'; if(isdigit(**arg)) { d *= 10; d += *(*arg)++ - '0'; } if((**arg == '-') && (y = *++(*arg))) { m = (y >= 'a' ? y - 'a' : y - 'A') * 1024; if((y = *++(*arg))) { m += (y >= 'a' ? y - 'a' : y - 'A') * 32; if((y = *++(*arg))) { m += (y >= 'a' ? y - 'a' : y - 'A'); switch(m) { case(('J'-'A') * 1024) + (('A'-'A') * 32) + ('N'-'A'): m = 1; break; case(('F'-'A') * 1024) + (('E'-'A') * 32) + ('B'-'A'): m = 2; break; case(('M'-'A') * 1024) + (('A'-'A') * 32) + ('R'-'A'): m = 3; break; case(('A'-'A') * 1024) + (('P'-'A') * 32) + ('R'-'A'): m = 4; break; case(('M'-'A') * 1024) + (('A'-'A') * 32) + ('Y'-'A'): m = 5; break; case(('J'-'A') * 1024) + (('U'-'A') * 32) + ('N'-'A'): m = 6; break; case(('J'-'A') * 1024) + (('U'-'A') * 32) + ('L'-'A'): m = 7; break; case(('A'-'A') * 1024) + (('U'-'A') * 32) + ('G'-'A'): m = 8; break; case(('S'-'A') * 1024) + (('E'-'A') * 32) + ('P'-'A'): m = 9; break; case(('O'-'A') * 1024) + (('C'-'A') * 32) + ('T'-'A'): m = 10;break; case(('N'-'A') * 1024) + (('O'-'A') * 32) + ('V'-'A'): m = 11;break; case(('D'-'A') * 1024) + (('E'-'A') * 32) + ('C'-'A'): m = 12;break; default: return NIL; } if((*++(*arg) == '-') && isdigit (*++(*arg))) { y = 0; do { y *= 10; y += *(*arg)++ - '0'; } while(isdigit(**arg)); if(d < 1 || d > 31 || m < 1 || m > 12 || y < 0) return NIL; if(y < 100) y += (y >= (BASEYEAR - 1900)) ? 1900 : 2000; *date = ((y - BASEYEAR) << 9) + (m << 5) + d; return T; } } } } } return NIL; } long _crit_string(STRINGLIST **string, char **arg) { unsigned long i; char c; char *s = _parse_astring(arg, &i, &c); if(!s) return NIL; while (*string) string = &(*string)->next; *string = mail_newstringlist (); (*string)->text.data = (unsigned char *) fs_get (i + 1); memcpy((*string)->text.data,s,i); (*string)->text.data[i] = '\0'; (*string)->text.size = i; if(!*arg) *arg = (char *) (*string)->text.data + i; else (*--(*arg) = c); return T; } char *_parse_astring(char **arg, unsigned long *size, char *del) { unsigned long i; char c,*s,*t,*v; if(!*arg) return NIL; switch(**arg) { default: for (s = t = *arg, i = 0; (*t > ' ') && (*t < 0x7f) && (*t != '(') && (*t != ')') && (*t != '{') && (*t != '%') && (*t != '*') && (*t != '"') && (*t != '\\'); ++t,++i); if(*size = i) break; case ')': case '%': case '*': case '\\': case '\0': case ' ': return NIL; case '"': for(s = t = v = *arg + 1; (c = *t++) != '"'; *v++ = c) { if(c == '\\') c = *t++; if(!c || (c & 0x80)) return NIL; } *v = '\0'; *size = v - s; break; case '{': s = *arg + 1; if(!isdigit (*s)) return NIL; if((*size = i = strtoul(s,&t,10)) > MAXCLIENTLIT) { mm_notify(NIL,"Absurdly long client literal",ERROR); return NIL; } if(!t || (*t != '}') || t[1]) return NIL; if(litsp >= LITSTKLEN) { mm_notify(NIL,"Too many literals in command",ERROR); return NIL; } _inliteral(s = litstk[litsp++] = (char *) fs_get(i+1),i); _slurp(*arg = t,TMPLEN - (t - cmdbuf)); if(!strchr(t, '\012')) return NIL; if(!strtok(t, "\015\012")) *t = '\0'; break; } if(*del = *t) { *t++ = '\0'; *arg = t; } else *arg = NIL; return s; } void _inliteral(char *s, unsigned long n) { /* warning, this need some debug */ s[n] = '\0'; } void _slurp(char *s, int n) { /* warning, this need some debug */ s[--n] = '\0'; } long _crit_set(SEARCHSET **set, char **arg, unsigned long maxima) { unsigned long i; *set = mail_newsearchset(); if (**arg == '*') { (*arg)++; (*set)->first = maxima; } else if(_crit_number(&i, arg) && i) (*set)->first = i; else return NIL; switch(**arg) { case ':': if(*++(*arg) == '*') { (*arg)++; (*set)->last -= maxima; } else if(_crit_number(&i,arg) && i) { if(i < (*set)->first) { (*set)->last = (*set)->first; (*set)->first = i; } else (*set)->last = i; } else return NIL; if(**arg != ',') break; case ',': (*arg)++; return _crit_set(&(*set)->next, arg, maxima); default: break; } return T; } long _crit_number(unsigned long *number, char **arg) { if(!isdigit (**arg)) return NIL; *number = 0; while (isdigit (**arg)) { *number *= 10; *number += *(*arg)++ - '0'; } return T; } SEARCHPGM *make_criteria(char *criteria) { SEARCHPGM *spgm; char tmp[MAILTMPLEN]; if(!criteria) return NIL; if(!_parse_criteria(spgm = mail_newsearchpgm(), &criteria, 0, 0, 0)) { sprintf(tmp, "Invalid search criteria string: %s", criteria); MM_LOG(tmp, ERROR); return NIL; } return spgm; } Mail-Cclient-1.12/Cclient.xs0000644000076400007640000020414110132016356016276 0ustar wwwadminweb00000000000000/* * Cclient.xs * Last Edited: Sat Oct 9 18:07:58 WEST 2004 * * Copyright (c) 1998 - 2004 Malcolm Beattie * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. */ /* * Must include mail.h before perl's stuff since mail.h uses op * and we can't simply undef it because we need it too for GIMME. * mail.h also defines INIT and OP_PROTOTYPE so we have to undefine * them afterwards since perl needs to define them too. Still worse: * we actually need the cclient INIT macro so we copy its definition * from mail.h and call it CCLIENT_LOCAL_INIT instead. This macro * therefore needs keeping in sync with mail.h. * For imap-2000 we also need to include stddef.h first to ensure * size_t is defined since misc.h needs it. */ #include #include "mail.h" #include "osdep.h" #include "rfc822.h" #include "misc.h" #include "smtp.h" #include "criteria.h" #define CCLIENT_LOCAL_INIT(s,d,data,size) \ ((*((s)->dtb = &d)->init) (s,data,size)) #undef INIT #ifdef OP_PROTOTYPE #undef OP_PROTOTYPE #endif #ifndef strcaseEQ #define strcaseEQ(s1,s2) (!strcasecmp(s1,s2)) #endif /* Ensure na and sv_undef get defined */ #define PERL_POLLUTE #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "utf8.h" #include "Cclient.h" typedef MAILSTREAM *Mail__Cclient; typedef SENDSTREAM *Mail__Cclient__SMTP; /* Magic signature for Cclient's mg_private is "Cc" */ #define Mail__Cclient_MAGIC_SIGNATURE 0x4363 #define MAX_LEN_ARRAY 14 #define MUST_EXIST 1 #define DATE_BUFF_SIZE 64 static HV *mailstream2sv; /* Map MAILSTREAM* to SV* */ static HV *stash_Cclient; /* Mail::Cclient:: stash */ static HV *stash_Address; /* Mail::Cclient::Address stash */ static HV *stash_Envelope; /* Mail::Cclient::Envelope stash */ static HV *stash_Body; /* Mail::Cclient::Body stash */ static HV *stash_Elt; /* Mail::Cclient::Elt stash */ static HV *callback; /* Maps callback names to Perl SV callbacks */ static SV *address_fields; /* \%Mail::Cclient::Address::FIELDS */ static SV *envelope_fields; /* \%Mail::Cclient::Envelope::FIELDS */ static SV *body_fields; /* \%Mail::Cclient::Body::FIELDS */ static SV *elt_fields; /* \%Mail::Cclient::Elt::FIELDS */ #include "patchlevel.h" #if PATCHLEVEL < 4 static SV *newRV_noinc(SV *ref) { SV *sv = newRV(ref); SvREFCNT_dec(ref); return sv; } #endif static SV *str_to_sv(char *str) { return str ? newSVpv(str, 0) : newSVsv(&sv_undef); } static HV *av_to_hv(AV *av, int n) { SV **keysp = av_fetch(av, n, FALSE); if(keysp) { SV *sv = *keysp; if(SvGMAGICAL(sv)) mg_get(sv); if(SvROK(sv)) { sv = SvRV(sv); if(SvTYPE(sv) == SVt_PVHV) return (HV*)sv; } } croak("Can't coerce array into hash"); return Nullhv; } static STRINGLIST *av_to_stringlist(AV *av) { STRINGLIST *rets = 0; STRINGLIST **s = &rets; SV **svp = AvARRAY(av); I32 count; for (count = av_len(av); count >= 0; count--) { STRLEN len; *s = mail_newstringlist(); (*s)->text.data = cpystr(SvPV(*svp, len)); (*s)->text.size = len; s = &(*s)->next; svp++; } return rets; } static SV *get_mailstream_sv(MAILSTREAM *stream, char *class) { SV **svp = hv_fetch(mailstream2sv, (char*)&stream, sizeof(stream), FALSE); SV *sv; #ifdef PERL_CCLIENT_DEBUG fprintf(stderr, "get_mailstream_sv(%p, %s), hv_fetch returns SV %p\n", stream, class, svp ? *svp : 0); /* debug */ #endif if(svp) sv = *svp; else { SV *rv = (SV*)newHV(); sv = sv_bless(newRV(rv), stash_Cclient); SvREFCNT_dec(rv); sv_magic(rv, newSViv((IV)stream), '~', 0, 0); SvMAGIC(rv)->mg_private = Mail__Cclient_MAGIC_SIGNATURE; hv_store(mailstream2sv, (char*)&stream, sizeof(stream), sv, 0); } #ifdef PERL_CCLIENT_DEBUG fprintf(stderr, "returning %p, type %d\n", sv, SvTYPE(sv)); /* debug */ #endif return sv; } static SV *mm_callback(char *name) { dSP; SV **svp = hv_fetch(callback, name, strlen(name), FALSE); #ifdef PERL_CCLIENT_DEBUG fprintf(stderr, "mm_callback(%s)\n", name); #endif if(svp && SvOK(*svp)) return *svp; return 0; } /* * SMTP */ char *generate_message_id() { static short osec = 0, cnt = 0; char *id; time_t now; struct tm *now_x; char *host; now = time((time_t *)0); now_x = localtime(&now); id = (char *)fs_get(128 * sizeof(char)); if(now_x->tm_sec == osec) cnt++; else { cnt = 0; osec = now_x->tm_sec; } host = getenv("HOSTNAME") ; if(!host) host = "localhost" ; sprintf(id,"", VERSION, OSNAME, (now_x->tm_year) % 100, now_x->tm_mon + 1, now_x->tm_mday, now_x->tm_hour, now_x->tm_min, now_x->tm_sec, cnt, getpid(), host); return(id); } static void make_mail_envelope(ENVELOPE *env, char *dhost, HV* hv) { if(hv_exists(hv, "from", 4)) { SV **value = hv_fetch(hv, "from", 4, 0); rfc822_parse_adrlist(&env->from, SvPV(*value, na), dhost); env->return_path = rfc822_cpy_adr(env->from); } if(hv_exists(hv, "to", 2)) { SV **value = hv_fetch(hv, "to", 2, 0); rfc822_parse_adrlist(&env->to, SvPV(*value, na), dhost); } if(hv_exists(hv, "cc", 2)) { SV **value = hv_fetch(hv, "cc", 2, 0); rfc822_parse_adrlist(&env->cc, SvPV(*value, na), dhost); } if(hv_exists(hv, "bcc", 3)) { SV **value = hv_fetch(hv, "bcc", 3, 0); rfc822_parse_adrlist(&env->bcc, SvPV(*value, na), dhost); } if(hv_exists(hv, "sender", 6)) { SV **value = hv_fetch(hv, "sender", 6, 0); rfc822_parse_adrlist(&env->sender, SvPV(*value, na), dhost); } if(hv_exists(hv, "reply_to", 8)) { SV **value = hv_fetch(hv, "reply_to", 8, 0); rfc822_parse_adrlist(&env->reply_to, SvPV(*value, na), dhost); } if(hv_exists(hv, "return_path", 11)) { SV **value = hv_fetch(hv, "return_path", 11, 0); rfc822_parse_adrlist(&env->return_path, SvPV(*value, na), dhost); } if(hv_exists(hv, "in_reply_to", 11)) { SV **value = hv_fetch(hv, "in_reply_to", 11, 0); env->in_reply_to = SvPV(*value, na); } if(hv_exists(hv, "message_id", 10)) { SV **value = hv_fetch(hv, "message_id", 10, 0); env->message_id = SvPV(*value, na); } else env->message_id = generate_message_id(); if(hv_exists(hv, "subject", 7)) { SV **value = hv_fetch(hv, "subject", 7, 0); env->subject = SvPV(*value, na); } if(hv_exists(hv, "remail", 6)) { SV **value = hv_fetch(hv, "remail", 6, 0); env->remail = SvPV(*value, na); } if(hv_exists(hv, "date", 4)) { SV **value = hv_fetch(hv, "date", 4, 0); env->date = SvPV(*value, na); } else { char buf[DATE_BUFF_SIZE]; rfc822_date(buf); env->date = cpystr(buf); } if(hv_exists(hv, "newsgroups", 10)) { SV **value = hv_fetch(hv, "newsgroups", 10, 0); env->newsgroups = SvPV(*value, na); } if(hv_exists(hv, "followup_to", 11)) { SV **value = hv_fetch(hv, "followup_to", 11, 0); env->followup_to = SvPV(*value, na); } if(hv_exists(hv, "references", 10)) { SV **value = hv_fetch(hv, "references", 11, 0); env->references = SvPV(*value, na); } } static PARAMETER *make_mail_parameter(SV *sv) { PARAMETER *param = NULL, *p = NULL; if(SvROK(sv) && SvTYPE(SvRV(sv))) { AV *av = (AV*)SvRV(sv); I32 k; for(k = 0; k < av_len(av) + 1; k++) { HV *hv = av_to_hv(av, k); if(p) p = p->next = mail_newbody_parameter(); else param = p = mail_newbody_parameter(); if(hv_exists(hv, "attribute", 9)) { SV **value = hv_fetch(hv, "attribute", 9, 0); p->attribute = SvPV(*value, na); } if(hv_exists(hv, "value", 5)) { SV **value = hv_fetch(hv, "value", 5, 0); p->value = SvPV(*value, na); } } } return(param); } int set_encoding(char *enc) { return(strcaseEQ(enc, "7bit") ? ENC7BIT : strcaseEQ(enc, "8bit") ? ENC8BIT : strcaseEQ(enc, "binary") ? ENCBINARY : strcaseEQ(enc, "base64") ? ENCBASE64 : strcaseEQ(enc, "quoted-printable") ? ENCQUOTEDPRINTABLE : ENCOTHER); } int set_type(char *type) { return(strcaseEQ(type, "text") ? TYPETEXT : strcaseEQ(type, "multipart") ? TYPEMULTIPART : strcaseEQ(type, "message") ? TYPEMESSAGE : strcaseEQ(type, "application") ? TYPEAPPLICATION : strcaseEQ(type, "audio") ? TYPEAUDIO : strcaseEQ(type, "image") ? TYPEIMAGE : strcaseEQ(type, "video") ? TYPEVIDEO : strcaseEQ(type, "model") ? TYPEMODEL : TYPEOTHER); } static void make_mail_disposition(SV *sv, BODY **body) { HV *hv = (HV*)SvRV(sv); if(hv_exists(hv, "type", 4)) { SV **v = hv_fetch(hv, "type", 4, 0); (*body)->disposition.type = SvPV(*v, na); } if(hv_exists(hv, "parameter", 9)) { SV **v = hv_fetch(hv, "parameter", 9, 0); (*body)->disposition.parameter = make_mail_parameter(*v); } } static void addfile(char *filename, SIZEDTEXT *st) { PerlIO *fp; unsigned char *data; struct stat statbuf; int bytesread; if ((fp = PerlIO_open(filename, "rb")) == NULL) { croak("Failed to open file \"%s\"", filename); return; } PerlLIO_fstat(PerlIO_fileno(fp), &statbuf); data = (char*)fs_get(statbuf.st_size); if(!(bytesread = PerlIO_read(fp, data, statbuf.st_size))) { return; } PerlIO_close(fp); st->data = (char*)fs_get(statbuf.st_size); memcpy(st->data, data, statbuf.st_size + 1); st->size = statbuf.st_size; free(data); } static void set_mime_type(BODY **body) { if((*body)->type == TYPEOTHER){ if((*body)->contents.text.data[0] == 'G' && (*body)->contents.text.data[1] == 'I' && (*body)->contents.text.data[2] == 'F') { (*body)->type = TYPEIMAGE; (*body)->subtype = cpystr("GIF"); } else if(((*body)->contents.text.size > 9) && (*body)->contents.text.data[0] == 0xFF && (*body)->contents.text.data[1] == 0xD8 && (*body)->contents.text.data[2] == 0xFF && (*body)->contents.text.data[3] == 0xE0 && !strncmp((char *)&(*body)->contents.text.data[6], "JFIF", 4)) { (*body)->type = TYPEIMAGE; (*body)->subtype = cpystr("JPEG"); } else if(((*body)->contents.text.size > 3) && (*body)->contents.text.data[0] == 0x89 && (*body)->contents.text.data[1] == 'P' && (*body)->contents.text.data[2] == 'N' && (*body)->contents.text.data[3] == 'G') { (*body)->type = TYPEIMAGE; (*body)->subtype = cpystr("PNG"); } else if(((*body)->contents.text.data[0] == 'M' && (*body)->contents.text.data[1] == 'M') || ((*body)->contents.text.data[0] == 'I' && (*body)->contents.text.data[1] == 'I')) { (*body)->type = TYPEIMAGE; (*body)->subtype = cpystr("TIFF"); } else if(((*body)->contents.text.data[0] == '%' && (*body)->contents.text.data[1] == '!') || ((*body)->contents.text.data[0] == '\004' && (*body)->contents.text.data[1] == '%' && (*body)->contents.text.data[2] == '!')) { (*body)->type = TYPEAPPLICATION; (*body)->subtype = cpystr("PostScript"); } else if((*body)->contents.text.data[0] == '%' && !strncmp((char*)(*body)->contents.text.data+1, "PDF-", 4)) { (*body)->type = TYPEAPPLICATION; (*body)->subtype = cpystr("PDF"); } else if((*body)->contents.text.data[0] == '.' && !strncmp((char*)(*body)->contents.text.data+1, "snd", 3)) { (*body)->type = TYPEAUDIO; (*body)->subtype = cpystr("Basic"); } else if(((*body)->contents.text.size > 3) && (*body)->contents.text.data[0] == 0x00 && (*body)->contents.text.data[1] == 0x05 && (*body)->contents.text.data[2] == 0x16 && (*body)->contents.text.data[3] == 0x00) { (*body)->type = TYPEAPPLICATION; (*body)->subtype = cpystr("APPLEFILE"); } else if(((*body)->contents.text.size > 3) && (*body)->contents.text.data[0] == 0x50 && (*body)->contents.text.data[1] == 0x4b && (*body)->contents.text.data[2] == 0x03 && (*body)->contents.text.data[3] == 0x04) { (*body)->type = TYPEAPPLICATION; (*body)->subtype = cpystr("ZIP"); } /* * if type was set above, but no encoding specified, go * ahead and make it BASE64... */ if((*body)->type != TYPEOTHER && (*body)->encoding == ENCOTHER) (*body)->encoding = ENCBINARY; } } static void make_mail_body(BODY *body, HV* hv) { if(hv_exists(hv, "content_type", 12)) { char *type = NULL, *subtype = NULL; SV **value = hv_fetch(hv, "content_type", 12, 0); char *ctype = SvPV(*value, na); type = strtok(ctype, "/"); if(type) { body->type = set_type(type); subtype = strtok(NULL, "/"); if(subtype) body->subtype = subtype; } } else body->type = TYPEOTHER; if(hv_exists(hv, "encoding", 8)) { SV **value = hv_fetch(hv, "encoding", 8, 0); body->encoding = set_encoding(SvPV(*value, na)); } if(hv_exists(hv, "disposition", 11)) { SV **value = hv_fetch(hv, "disposition", 11, 0); make_mail_disposition(*value, &body); } if(hv_exists(hv, "parameter", 9)) { SV **value = hv_fetch(hv, "parameter", 9, 0); body->parameter = make_mail_parameter(*value); } if(hv_exists(hv, "description", 11)) { SV **value = hv_fetch(hv, "description", 11, 0); body->description = SvPV(*value, na); } if(hv_exists(hv, "id", 2)) { SV **value = hv_fetch(hv, "id", 2, 0); body->id = SvPV(*value, na); } if(hv_exists(hv, "language", 8)) { SV **value = hv_fetch(hv, "language", 8, 0); body->language = av_to_stringlist((AV*)SvRV(*value)); } #ifdef DR_NONEWMAIL if(hv_exists(hv, "location", 8)) { SV **value = hv_fetch(hv, "location", 8, 0); body->location = SvPV(*value, na); } #endif if(hv_exists(hv, "md5", 3)) { SV **value = hv_fetch(hv, "md5", 3, 0); body->md5 = SvPV(*value, na); } if(hv_exists(hv, "path", 4)) { SV **value = hv_fetch(hv, "path", 4, 0); unsigned char *data; addfile(SvPV(*value, na), &body->contents.text); if(body->type == TYPEOTHER) set_mime_type(&body); } else if(hv_exists(hv, "data", 4)) { SV **value = hv_fetch(hv, "data", 4, 0); STRLEN len; body->contents.text.data = SvPV(*value, len); body->contents.text.size = len; body->size.bytes = (int)(len/8); } if(hv_exists(hv, "part", 4)) { SV **value = hv_fetch(hv, "part", 4, 0); PART **part = &body->nested.part; AV *av = (AV*)SvRV(*value); I32 len = av_len(av) + 1; I32 k; if(!body->type || body->type != TYPEMULTIPART) body->type = TYPEMULTIPART; for(k = 0; k < len; k++) { HV *hv = av_to_hv(av, k); *part = mail_newbody_part(); make_mail_body(&(*part)->body, hv); part = &(*part)->next; } } } long transfer(void *f, char *buf) { PerlIO_write(f, buf, strlen(buf)); return(1L); } static void save_rfc822_tmp(ENVELOPE *env, BODY *body, PerlIO *fp) { char tmp[8*MAILTMPLEN]; rfc822_output(tmp, env, body, transfer, fp, 1); } /* * C-client data structure manipulation */ /* * make_address turns a C-client ADDRESS (representing a list of * email addresses) into a Perl ref to a list of addresses. Each * single address is represented by Perl as a list ref * [keyref, personal, adl, mailbox, host, error] * (though the error entry is optional and may be absent) * blessed into class Mail::Cclient::Address. keyref is a ref to * %Mail::Cclient::Address::FIELDS for 5.005 pseudo-hash access to the * object. Note that make_address returns an AV*, not a ref to one. */ static AV * make_address(ADDRESS *address) { AV *alist = newAV(); for (; address; address = address->next) { AV *a = newAV(); av_push(a, SvREFCNT_inc(address_fields)); av_push(a, str_to_sv(address->personal)); av_push(a, str_to_sv(address->adl)); av_push(a, str_to_sv(address->mailbox)); av_push(a, str_to_sv(address->host)); if(address->error) av_push(a, str_to_sv(address->error)); av_push(alist, sv_bless(newRV_noinc((SV*)a), stash_Address)); } return alist; } /* * make_envelope turns a C-client ENVELOPE (representing the * RFC822 headers of a message) into a Perl list ref of the form * [keyref, remail, return_path, date, from, sender, reply_to, * subject, to, cc, bcc, in_reply_to, message_id, * newsgroups, followup_to, references] * blessed into Mail::Cclient::Envelope. keyref is a ref to * %Mail::Cclient::Envelope::FIELDS for 5.005 pseudo-hash access * to the object. */ static SV * make_envelope(ENVELOPE *envelope) { AV *e = newAV(); av_push(e, SvREFCNT_inc(envelope_fields)); av_push(e, str_to_sv(envelope->remail)); av_push(e, newRV_noinc((SV*)make_address(envelope->return_path))); av_push(e, str_to_sv(envelope->date)); av_push(e, newRV_noinc((SV*)make_address(envelope->from))); av_push(e, newRV_noinc((SV*)make_address(envelope->sender))); av_push(e, newRV_noinc((SV*)make_address(envelope->reply_to))); av_push(e, str_to_sv(envelope->subject)); av_push(e, newRV_noinc((SV*)make_address(envelope->to))); av_push(e, newRV_noinc((SV*)make_address(envelope->cc))); av_push(e, newRV_noinc((SV*)make_address(envelope->bcc))); av_push(e, str_to_sv(envelope->in_reply_to)); av_push(e, str_to_sv(envelope->message_id)); av_push(e, str_to_sv(envelope->newsgroups)); av_push(e, str_to_sv(envelope->followup_to)); av_push(e, str_to_sv(envelope->references)); return sv_bless(newRV_noinc((SV*)e), stash_Envelope); } /* * make_elt turns a C-client MESSAGECACHE ("elt") into a Perl list * ref of the form * [keyref, msgno, date, flags, rfc822_size, imapdate] * blessed into Mail::Cclient::Elt. Date contains the internal date * information which held in separate bit fields in the underlying * C structure but which is presented in Perl as a string in the form * yyyy-mm-dd hh:mm:ss [+-]hhmm * The imapdate field contains the same date but in the form * dd-mmm-yyyy hh:mm:ss [+-]hhmm * as specified in RFC2060. * The flags field is a ref to a list of strings such as * \Deleted, \Flagged, \Answered etc (as per RFC 2060) plus * user-defined flag names set via the Mail::Cclient setflag method. * %Mail::Cclient::Envelope::FIELDS for 5.005 pseudo-hash access * to the object. keyref is a ref to %Mail::Cclient::Elt::FIELDS for * 5.005 pseudo-hash access to the object. */ static SV * make_elt(MAILSTREAM *stream, MESSAGECACHE *elt) { AV *av = newAV(); AV *flags = newAV(); char datebuf[27]; /* to fit "dd-mmm-yyyy hh:mm:ss [+-]hhmm\0" */ static char *months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; int i; av_push(av, SvREFCNT_inc(elt_fields)); av_push(av, newSViv(elt->msgno)); /* * year field is OK until 2098 since it's an offset from BASEYEAR * which in newer cclients is 1970 (was 1969) and elt->year is a * bitfield with 7 bits. */ sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d %c%02d%02d", BASEYEAR + elt->year, elt->month, elt->day, elt->hours, elt->minutes, elt->seconds, elt->zoccident ? '-' : '+', elt->zhours, elt->zminutes); av_push(av, newSVpv(datebuf, sizeof(datebuf))); if(elt->seen) av_push(flags, newSVpv("\\Seen", 5)); if(elt->deleted) av_push(flags, newSVpv("\\Deleted", 8)); if(elt->flagged) av_push(flags, newSVpv("\\Flagged", 8)); if(elt->answered) av_push(flags, newSVpv("\\Answered", 9)); if(elt->draft) av_push(flags, newSVpv("\\Draft", 6)); if(elt->valid) av_push(flags, newSVpv("\\Valid", 6)); if(elt->recent) av_push(flags, newSVpv("\\Recent", 7)); if(elt->searched) av_push(flags, newSVpv("\\Searched", 9)); for(i = 0; i < NUSERFLAGS; i++) { if(elt->user_flags & (1 << i)) { char *fl = stream->user_flags[i]; SV *sv = fl ? newSVpv(fl, 0) : newSVpvf("user_flag_%d", i); av_push(flags, sv); } } av_push(av, newRV_noinc((SV*)flags)); av_push(av, newSViv(elt->rfc822_size)); sprintf(datebuf, "%02d-%s-%04d %02d:%02d:%02d %c%02d%02d", elt->day, months[elt->month], BASEYEAR + elt->year, elt->hours, elt->minutes, elt->seconds, elt->zoccident ? '-' : '+', elt->zhours, elt->zminutes); av_push(av, newSVpv(datebuf, sizeof(datebuf))); return sv_bless(newRV_noinc((SV*)av), stash_Elt); } /* * make_thread */ static AV * make_thread(THREADNODE *thr) { AV *av = newAV(); AV *av_branch; AV *av_branch_tmp = newAV(); I32 i = 0; I32 i_max; THREADNODE *t; while(thr) { if(thr->num) { av_branch = newAV(); av_push(av_branch, newSViv(thr->num)); if(t = thr->next) { while(t) { if(t->branch) { av_branch_tmp = make_thread(t); i_max = av_len(av_branch_tmp); for(i=0; i<= i_max; i++) av_push(av_branch, av_shift(av_branch_tmp)); av_undef(av_branch_tmp); t = NIL; } else { av_push(av_branch, newSViv(t->num)); t = t->next; } } } av_push(av, newRV_noinc((SV*)av_branch)); } else { av_push(av, newRV_noinc((SV*)make_thread(thr->next))); } thr = thr->branch; } return av; } /* * make_sort */ static AV * make_sort(unsigned long *slst) { AV *av = newAV(); unsigned long *sl; for(sl = slst; *sl; sl++) { av_push(av, newSViv(*sl)); } return av; } static AV * stringlist_to_av(STRINGLIST *s) { AV *av = newAV(); for (; s; s = s->next) av_push(av, newSVpv(s->text.data, s->text.size)); return av; } static AV * push_parameter(AV *av, PARAMETER *param) { for(; param; param = param->next) { av_push(av, newSVpv(param->attribute, 0)); av_push(av, newSVpv(param->value, 0)); } return av; } static SV * make_body(BODY *body) { AV *av = newAV(); SV *nest; AV *paramav = newAV(); av_push(av, SvREFCNT_inc(body_fields)); av_push(av, newSVpv(body_types[body->type], 0)); av_push(av, newSVpv(body_encodings[body->encoding], 0)); av_push(av, str_to_sv(body->subtype)); av_push(av, newRV_noinc((SV*)push_parameter(newAV(), body->parameter))); av_push(av, str_to_sv(body->id)); av_push(av, str_to_sv(body->description)); if (body->type == TYPEMULTIPART) { AV *parts = newAV(); PART *p; for (p = body->nested.part; p; p = p->next) av_push(parts, make_body(&p->body)); nest = newRV_noinc((SV*)parts); } else if (body->type == TYPEMESSAGE && strEQ(body->subtype, "RFC822")) { AV *mess = newAV(); MESSAGE *msg = body->nested.msg; av_push(mess, msg ? make_envelope(msg->env) : &sv_undef); av_push(mess, msg ? make_body(msg->body) : &sv_undef); nest = newRV_noinc((SV*)mess); } else nest = newSVsv(&sv_undef); av_push(av, nest); av_push(av, newRV_noinc((SV*)stringlist_to_av(body->language))); #ifdef DR_NONEWMAIL av_push(av, str_to_sv(body->location)); #else av_push(av, str_to_sv("")); #endif av_push(av, newSViv(body->size.lines)); av_push(av, newSViv(body->size.bytes)); av_push(av, str_to_sv(body->md5)); av_push(paramav, str_to_sv(body->disposition.type)); paramav = push_parameter(paramav, body->disposition.parameter); av_push(av, newRV_noinc((SV*)paramav)); return sv_bless(newRV_noinc((SV*)av), stash_Body); } /* * Interfaces to C-client callbacks */ void mm_searched(MAILSTREAM *stream, unsigned long number) { dSP; SV *sv = mm_callback("searched"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(number))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_exists(MAILSTREAM *stream, unsigned long number) { dSP; SV *sv = mm_callback("exists"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(number))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_expunged(MAILSTREAM *stream, unsigned long number) { dSP; SV *sv = mm_callback("expunged"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(number))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_flags(MAILSTREAM *stream, unsigned long number) { dSP; SV *sv = mm_callback("flags"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(number))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_notify(MAILSTREAM *stream, char *string, long errflg) { dSP; SV *sv = mm_callback("notify"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSVpv(string, 0))); XPUSHs(sv_2mortal(newSViv(errflg))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_list(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes) { dSP; char delimchar; SV *sv = mm_callback("list"); if (!sv) return; delimchar = (char)delimiter; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSVpv(&delimchar, 1))); XPUSHs(sv_2mortal(newSVpv(mailbox, 0))); if (attributes & LATT_NOINFERIORS) XPUSHs(sv_2mortal(newSVpv("noinferiors", 0))); if (attributes & LATT_NOSELECT) XPUSHs(sv_2mortal(newSVpv("noselect", 0))); if (attributes & LATT_MARKED) XPUSHs(sv_2mortal(newSVpv("marked", 0))); if (attributes & LATT_UNMARKED) XPUSHs(sv_2mortal(newSVpv("unmarked", 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes) { dSP; SV *sv = mm_callback("lsub"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(delimiter))); XPUSHs(sv_2mortal(newSVpv(mailbox, 0))); XPUSHs(sv_2mortal(newSViv(attributes))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS *status) { dSP; SV *sv = mm_callback("status"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSVpv(mailbox, 0))); if (status->flags & SA_MESSAGES) { XPUSHs(sv_2mortal(newSVpv("messages", 0))); XPUSHs(sv_2mortal(newSViv(status->messages))); } if (status->flags & SA_RECENT) { XPUSHs(sv_2mortal(newSVpv("recent", 0))); XPUSHs(sv_2mortal(newSViv(status->recent))); } if (status->flags & SA_UNSEEN) { XPUSHs(sv_2mortal(newSVpv("unseen", 0))); XPUSHs(sv_2mortal(newSViv(status->unseen))); } if (status->flags & SA_UIDVALIDITY) { XPUSHs(sv_2mortal(newSVpv("uidvalidity", 0))); XPUSHs(sv_2mortal(newSViv(status->uidvalidity))); } if (status->flags & SA_UIDNEXT) { XPUSHs(sv_2mortal(newSVpv("uidnext", 0))); XPUSHs(sv_2mortal(newSViv(status->uidnext))); } PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_log(char *string, long errflg) { dSP; SV *sv = mm_callback("log"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_2mortal(newSVpv(string, 0))); XPUSHs(sv_2mortal(newSVpv(( errflg == NIL ? "info" : errflg == PARSE ? "parse" : errflg == WARN ? "warn" : errflg == ERROR ? "error" : "unknown"), 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_dlog(char *string) { dSP; SV *sv = mm_callback("dlog"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_2mortal(newSVpv(string, 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_fatal (char *string) { dSP; SV *sv = mm_callback("fatal"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_2mortal(newSVpv(string, 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_login(NETMBX *mb, char *user, char *password, long trial) { dSP; SV *sv = mm_callback("login"); HV *hv; SV *retsv; STRLEN len; char *str; I32 items; if (!sv) croak("mandatory login callback not set"); ENTER; SAVETMPS; PUSHMARK(sp); hv = newHV(); hv_store(hv, "host", 4, str_to_sv(mb->host), 0); hv_store(hv, "user", 4, str_to_sv(mb->user), 0); hv_store(hv, "mailbox", 7, str_to_sv(mb->mailbox), 0); hv_store(hv, "service", 7, str_to_sv(mb->service), 0); hv_store(hv, "port", 4, newSViv(mb->port), 0); if(mb->anoflag) hv_store(hv, "anoflag", 7, newSViv(1), 0); if(mb->dbgflag) hv_store(hv, "dbgflag", 7, newSViv(1), 0); if(mb->secflag) hv_store(hv, "secflag", 7, newSViv(1), 0); if(mb->sslflag) hv_store(hv, "sslflag", 7, newSViv(1), 0); if(mb->trysslflag) hv_store(hv, "trysslflag", 10, newSViv(1), 0); if(mb->novalidate) hv_store(hv, "novalidate", 10, newSViv(1), 0); XPUSHs(sv_2mortal(newRV((SV*)hv))); SvREFCNT_dec((SV*)hv); XPUSHs(sv_2mortal(newSViv(trial))); PUTBACK; items = perl_call_sv(sv, G_ARRAY); SPAGAIN; if (items != 2) croak("login callback failed to return (user, password)"); retsv = POPs; /* password */ str = SvPV(retsv, len); /* * By brief inspection (but it's not documented), c-client seems * to pass a buffer of size MAILTMPLEN for the user and password * strings so we make sure we don't copy in more than that. * We don't use strcnpy all the time since it pads its destination * with \0 characters and there may be parts of c-client that * don't actually pass in that large a buffer. */ if (len >= MAILTMPLEN) strncpy(password, str, MAILTMPLEN - 1); else strcpy(password, str); retsv = POPs; /* user */ str = SvPV(retsv, len); if (len >= MAILTMPLEN) strncpy(user, str, MAILTMPLEN - 1); else strcpy(user, str); PUTBACK; FREETMPS; LEAVE; } void mm_critical(MAILSTREAM *stream) { dSP; SV *sv = mm_callback("critical"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } void mm_nocritical(MAILSTREAM *stream) { dSP; SV *sv = mm_callback("nocritical"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); PUTBACK; perl_call_sv(sv, G_DISCARD); } long mm_diskerror(MAILSTREAM *stream, long errcode, long serious) { dSP; SV *sv = mm_callback("diskerror"); if (!sv) return; PUSHMARK(sp); XPUSHs(sv_mortalcopy(get_mailstream_sv(stream, 0))); XPUSHs(sv_2mortal(newSViv(errcode))); XPUSHs(sv_2mortal(newSViv(serious))); PUTBACK; perl_call_sv(sv, G_DISCARD); } MODULE = Mail::Cclient PACKAGE = Mail::Cclient PREFIX = mail_ PROTOTYPES: DISABLE Mail::Cclient mail_open(stream, mailbox, ...) Mail::Cclient stream char *mailbox PREINIT: int i; long options = 0; CODE: for (i = 2; i < items; i++) { char *option = SvPV(ST(i), na); if(strEQ(option, "debug")) options |= OP_DEBUG; else if(strEQ(option, "readonly")) options |= OP_READONLY; else if(strEQ(option, "anonymous")) options |= OP_ANONYMOUS; else if(strEQ(option, "shortcache")) options |= OP_SHORTCACHE; else if(strEQ(option, "silent")) options |= OP_SILENT; else if(strEQ(option, "prototype")) options |= OP_PROTOTYPE; else if(strEQ(option, "halfopen")) options |= OP_HALFOPEN; else if(strEQ(option, "expunge")) options |= OP_EXPUNGE; else if(strEQ(option, "secure")) options |= OP_SECURE; else if(strEQ(option, "tryssl")) options |= OP_TRYSSL; else if(strEQ(option, "mulnewsrc")) options |= OP_MULNEWSRC; else { croak("unknown option \"%s\" passed to Mail::Cclient::open", option); } } if(stream) hv_delete(mailstream2sv, (char*)stream, sizeof(stream), G_DISCARD); RETVAL = mail_open(stream, mailbox, options); if(!RETVAL) XSRETURN_UNDEF; OUTPUT: RETVAL CLEANUP: #ifdef PERL_CCLIENT_DEBUG fprintf(stderr, "storing stream %p\n", RETVAL); /*debug*/ #endif hv_store(mailstream2sv, (char*)&RETVAL, sizeof(RETVAL), SvREFCNT_inc(ST(0)), 0); void mail_close(stream, ...) Mail::Cclient stream CODE: hv_delete(mailstream2sv, (char*)stream, sizeof(stream), G_DISCARD); if(items == 1) mail_close(stream); else { long options = 0; int i; for(i = 1; i < items; i++) { char *option = SvPV(ST(i), na); if(strEQ(option, "expunge")) options |= CL_EXPUNGE; else { croak("unknown option \"%s\" passed to" " Mail::Cclient::close", option); } } mail_close_full(stream, options); } void mail_list(stream, ref, pat) Mail::Cclient stream char *ref char *pat void mail_scan(stream, ref, pat, contents) Mail::Cclient stream char *ref char *pat char *contents void mail_lsub(stream, ref, pat) Mail::Cclient stream char *ref char *pat unsigned long mail_subscribe(stream, mailbox) Mail::Cclient stream char *mailbox unsigned long mail_unsubscribe(stream, mailbox) Mail::Cclient stream char *mailbox unsigned long mail_create(stream, mailbox) Mail::Cclient stream char *mailbox unsigned long mail_delete(stream, mailbox) Mail::Cclient stream char *mailbox unsigned long mail_rename(stream, oldname, newname) Mail::Cclient stream char *oldname char *newname long mail_status(stream, mailbox, ...) Mail::Cclient stream char *mailbox PREINIT: int i; long flags = 0; CODE: for (i = 2; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "messages")) flags |= SA_MESSAGES; else if (strEQ(flag, "recent")) flags |= SA_RECENT; else if (strEQ(flag, "unseen")) flags |= SA_UNSEEN; else if (strEQ(flag, "uidnext")) flags |= SA_UIDNEXT; else if (strEQ(flag, "uidvalidity")) flags |= SA_UIDVALIDITY; else { croak("unknown flag \"%s\" passed to Mail::Cclient::status", flag); } } RETVAL = mail_status(stream, mailbox, flags); OUTPUT: RETVAL MODULE = Mail::Cclient PACKAGE = Mail::Cclient PREFIX = mailstream_ #define mailstream_mailbox(stream) stream->mailbox #define mailstream_use(stream) stream->use #define mailstream_sequence(stream) stream->sequence #define mailstream_rdonly(stream) stream->rdonly #define mailstream_anonymous(stream) stream->anonymous #define mailstream_halfopen(stream) stream->halfopen #define mailstream_secure(stream) stream->secure #define mailstream_tryssl(stream) stream->tryssl #define mailstream_mulnewsrc(stream) stream->mulnewsrc #define mailstream_perm_seen(stream) stream->perm_seen #define mailstream_perm_deleted(stream) stream->perm_deleted #define mailstream_perm_flagged(stream) stream->perm_flagged #define mailstream_perm_answered(stream) stream->perm_answered #define mailstream_perm_draft(stream) stream->perm_draft #define mailstream_kwd_create(stream) stream->kwd_create #define mailstream_nmsgs(stream) stream->nmsgs #define mailstream_recent(stream) stream->recent #define mailstream_uid_validity(stream) stream->uid_validity #define mailstream_uid_last(stream) stream->uid_last char * mailstream_mailbox(stream) Mail::Cclient stream unsigned short mailstream_use(stream) Mail::Cclient stream unsigned short mailstream_sequence(stream) Mail::Cclient stream unsigned int mailstream_rdonly(stream) Mail::Cclient stream unsigned int mailstream_anonymous(stream) Mail::Cclient stream unsigned int mailstream_halfopen(stream) Mail::Cclient stream unsigned int mailstream_secure(stream) Mail::Cclient stream unsigned int mailstream_tryssl(stream) Mail::Cclient stream unsigned int mailstream_mulnewsrc(stream) Mail::Cclient stream unsigned int mailstream_perm_seen(stream) Mail::Cclient stream unsigned int mailstream_perm_deleted(stream) Mail::Cclient stream unsigned int mailstream_perm_flagged(stream) Mail::Cclient stream unsigned int mailstream_perm_answered(stream) Mail::Cclient stream unsigned int mailstream_perm_draft(stream) Mail::Cclient stream unsigned int mailstream_kwd_create(stream) Mail::Cclient stream unsigned long mailstream_nmsgs(stream) Mail::Cclient stream unsigned long mailstream_recent(stream) Mail::Cclient stream unsigned long mailstream_uid_validity(stream) Mail::Cclient stream unsigned long mailstream_uid_last(stream) Mail::Cclient stream void mailstream_perm_user_flags(stream) Mail::Cclient stream PREINIT: int i; PPCODE: for (i = 0; i < NUSERFLAGS; i++) if (stream->perm_user_flags & (1 << i)) XPUSHs(sv_2mortal(newSVpv(stream->user_flags[i], 0))); MODULE = Mail::Cclient PACKAGE = Mail::Cclient PREFIX = mail_ # # Message Data Fetching Functions # void mail_fetch_fast(stream, sequence, ...) Mail::Cclient stream char *sequence ALIAS: Mail::Cclient::fetchfast = 1 PREINIT: int i; long flags = 0; PPCODE: for (i = 2; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else { croak("unknown flag \"%s\" passed to Mail::Cclient::fetch_fast", flag); } } mail_fetch_fast(stream, sequence, flags); ST(0) = &sv_yes; void mail_fetch_flags(stream, sequence, ...) Mail::Cclient stream char *sequence ALIAS: Mail::Cclient::fetchflags = 1 PREINIT: int i; long flags = 0; PPCODE: for (i = 2; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_flags", flag); } } mail_fetch_flags(stream, sequence, flags); ST(0) = &sv_yes; void mail_fetch_structure(stream, msgno, ...) Mail::Cclient stream unsigned long msgno ALIAS: Mail::Cclient::fetchstructure = 1 PREINIT: int i; long flags = 0; ENVELOPE *e; BODY **bodyp = 0; BODY *body = 0; PPCODE: for (i = 2; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_structure", flag); } } if (GIMME == G_ARRAY) bodyp = &body; e = mail_fetch_structure(stream, msgno, bodyp, flags); XPUSHs(sv_2mortal(make_envelope(e))); if (GIMME == G_ARRAY) XPUSHs(sv_2mortal(make_body(body))); void mail_thread(stream, ...) Mail::Cclient stream PREINIT: char *threading = ""; char *cs = NIL; char *search_criteria = NIL; SEARCHPGM *spg = NIL; THREADNODE *thread; int i; long flags = 0; PPCODE: if(items > 9 || floor(fmod(items+1, 2))) croak("Wrong numbers of args (KEY => value)" " passed to Mail::Cclient::thread"); for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "threading")) threading = SvPV(ST(i+1), na); else if(strcaseEQ(key, "charset")) cs = SvPV(ST(i+1), na); else if(strcaseEQ(key, "search")) search_criteria = SvPV(ST(i+1), na); else if(strcaseEQ(key, "flag")) { char *flag = SvPV(ST(i+1), na); if (strEQ(flag, "uid")) flags |= SE_UID; else croak("unknown FLAG => \"%s\" value passed to" " Mail::Cclient::thread", flag); } else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::thread", key); } spg = (search_criteria) ? make_criteria(search_criteria) : mail_newsearchpgm(); thread = mail_thread(stream, (strEQ(threading, "references")) ? "REFERENCES" : "ORDEREDSUBJECT", cs, spg, flags); if(thread) { XPUSHs(sv_2mortal(newRV_noinc((SV*)make_thread(thread)))); mail_free_threadnode(&thread); } if(spg) mail_free_searchpgm(&spg); void mail_sort(stream, ...) Mail::Cclient stream PREINIT: char *cs = NIL; char *search_criteria = NIL; AV *array; SEARCHPGM *spg = NIL; SORTPGM *pgm = NIL, *pg = NIL; unsigned long *slst; I32 idx; I32 len = 0; int i; long flags = 0; PPCODE: if(items < 3 || items > 9 || floor(fmod(items+1, 2))) croak("Wrong numbers of args (KEY => value)" " passed to Mail::Cclient::sort"); for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "sort")) { SV *arrayRef = ST(i+1); if(SvROK(arrayRef) && SvTYPE(SvRV(arrayRef))) { array = (AV*)SvRV(arrayRef); len = av_len(array) + 1; if(floor(fmod(len, 2)) || !len) croak("SORT => wrong numbers of elements in array ref" " passed to Mail::Cclient::sort"); if(len > MAX_LEN_ARRAY) croak("SORT => max length of elements exceeded in array ref" " passed to Mail::Cclient::sort"); } else croak("SORT => not array ref" " passed to Mail::Cclient::sort"); } else if(strcaseEQ(key, "charset")) cs = SvPV(ST(i+1), na); else if(strcaseEQ(key, "search")) search_criteria = SvPV(ST(i+1), na); else if(strcaseEQ(key, "flag")) { AV *avflags; int k; SV *svflags = ST(i+1); if(SvROK(svflags) && SvTYPE(SvRV(svflags))) avflags = (AV*)SvRV(svflags); else { avflags = newAV(); av_push(avflags, svflags); } for (k = 0; k < av_len(avflags) + 1; k++) { SV **allflags = av_fetch(avflags, k, 0); char *flag = SvPV(*allflags, na); if(strEQ(flag, "uid")) flags |= SE_UID; else if(strEQ(flag, "searchfree")) flags |= SE_FREE; else if(strEQ(flag, "noprefetch")) flags |= SE_NOPREFETCH; else if(strEQ(flag, "sortfree")) flags |= SO_FREE; else croak("unknown FLAG => \"%s\" value passed to" " Mail::Cclient::sort", flag); } if(flags) av_undef(avflags); } else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::sort", key); } if(!len) croak("no SORT key/value passed to Mail::Cclient::sort"); spg = (search_criteria) ? make_criteria(search_criteria) : mail_newsearchpgm(); for(idx = 0; idx < len; idx = idx+2) { SV **n; char *criteria = ""; SV **elem = av_fetch(array, idx, 0); if(pg) pg = pg->next = mail_newsortpgm(); else pgm = pg = mail_newsortpgm(); if(SvPOKp(*elem)) criteria = SvPV(*elem, na); pg->function = (strEQ(criteria, "subject")) ? SORTSUBJECT : (strEQ(criteria, "from")) ? SORTFROM : (strEQ(criteria, "to")) ? SORTTO : (strEQ(criteria, "cc")) ? SORTCC : (strEQ(criteria, "date")) ? SORTDATE : (strEQ(criteria, "size")) ? SORTSIZE : SORTARRIVAL; n = av_fetch(array, idx+1, 0); pg->reverse = (SvIOK(*n)) ? SvIV(*n) : NIL; } slst = mail_sort(stream, cs, spg, pgm, flags); if(spg) mail_free_searchpgm(&spg); if(slst != NIL && slst != 0) { XPUSHs(sv_2mortal(newRV_noinc((SV*)make_sort(slst)))); fs_give ((void **) &slst); } av_undef(array); safefree(pgm); void mail_fetch_message(stream, msgno, ...) Mail::Cclient stream unsigned long msgno PREINIT: int i; long flags = 0; unsigned long len; char *msg; PPCODE: for (i = 2; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_message", flag); } } msg = mail_fetch_message(stream, msgno, &len, flags); XPUSHs(sv_2mortal(newSVpv(msg, len))); void mail_fetch_header(stream, msgno, ...) Mail::Cclient stream unsigned long msgno ALIAS: Mail::Cclient::fetchheader = 1 PREINIT: int i; int n = 2; char *section = NIL; long flags = 0; STRINGLIST *lines = 0; unsigned long len; char *hdr; PPCODE: if(ix == 0 && items > 2) { section = SvPV(ST(2), na); n++; } for (i = n; i < items; i++) { SV *sv = ST(i); if (SvROK(sv)) { sv = (SV*)SvRV(sv); if (SvTYPE(sv) != SVt_PVAV) { croak("reference to non-list passed to" " Mail::Cclient::fetch_header"); } lines = av_to_stringlist((AV*)sv); } else { char *flag = SvPV(sv, na); if (strEQ(flag, "uid")) flags |= FT_UID; else if (strEQ(flag, "not")) flags |= FT_NOT; else if (strEQ(flag, "internal")) flags |= FT_INTERNAL; else if (strEQ(flag, "prefetchtext")) flags |= FT_PREFETCHTEXT; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_header", flag); } } } hdr = mail_fetch_header(stream, msgno, section, lines, &len, flags); XPUSHs(sv_2mortal(newSVpv(hdr, len))); if(lines) mail_free_stringlist(&lines); void mail_fetch_text(stream, msgno, ...) Mail::Cclient stream unsigned long msgno ALIAS: Mail::Cclient::fetchtext = 1 PREINIT: int i; int n = 2; char *section = NIL; long flags = 0; unsigned long len; char *text; PPCODE: if(ix == 0 && items > 2) { section = SvPV(ST(2), na); n++; } for (i = n; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else if (strEQ(flag, "peek")) flags |= FT_PEEK; else if (strEQ(flag, "internal")) flags |= FT_INTERNAL; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_text", flag); } } text = mail_fetch_text(stream, msgno, section, &len, flags); XPUSHs(sv_2mortal(newSVpv(text, len))); void mail_fetch_mime(stream, msgno, section = NIL, ...) Mail::Cclient stream unsigned long msgno char *section PREINIT: int i; long flags = 0; unsigned long len; char *mime; PPCODE: for (i = 3; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= FT_UID; else if (strEQ(flag, "internal")) flags |= FT_INTERNAL; else { croak("unknown flag \"%s\" passed to" " Mail::Cclient::fetch_mime", flag); } } mime = mail_fetch_mime(stream, msgno, section, &len, flags); XPUSHs(sv_2mortal((mime) ? newSVpvn(mime, len) : newSVpv("", 0))); void mail_fetch_body(stream, msgno, section = NIL, ...) Mail::Cclient stream unsigned long msgno char *section ALIAS: Mail::Cclient::fetchbody = 1 PREINIT: int i; long flags = 0; unsigned long len; char *body; PPCODE: for(i = 3; i < items; i++) { char *flag = SvPV(ST(i), na); if(strEQ(flag, "uid")) flags |= FT_UID; else if(strEQ(flag, "peek")) flags |= FT_PEEK; else if(strEQ(flag, "internal")) flags |= FT_INTERNAL; else croak("unknown flag \"%s\" passed to Mail::Cclient::fetch_body", flag); } body = mail_fetch_body(stream, msgno, section, &len, flags); XPUSHs(sv_2mortal(newSVpv(body, len))); unsigned long mail_uid(stream, msgno) Mail::Cclient stream unsigned long msgno unsigned long mail_msgno (stream, uid) Mail::Cclient stream unsigned long uid void mail_elt(stream, msgno) Mail::Cclient stream unsigned long msgno PREINIT: MESSAGECACHE *elt; PPCODE: elt = mail_elt(stream, msgno); XPUSHs(elt ? sv_2mortal(make_elt(stream, elt)) : &sv_undef); # # Message Status Manipulation Functions # void mail_setflag(stream, sequence, flag, ...) Mail::Cclient stream char *sequence char *flag PREINIT: int i; long flags = 0; ALIAS: clearflag = 1 CODE: for(i = 3; i < items; i++) { char *fl = SvPV(ST(i), na); if(strEQ(fl, "uid")) flags |= ST_UID; else if (strEQ(fl, "silent")) flags |= ST_SILENT; else { croak("unknown flag \"%s\" passed to Mail::Cclient::%s", fl, ix == 1 ? "setflag" : "clearflag"); } } if(ix == 1) mail_clearflag_full(stream, sequence, flag, flags); else mail_setflag_full(stream, sequence, flag, flags); # # Miscellaneous Mailbox and Message Functions # long mail_ping(stream) Mail::Cclient stream void mail_check(stream) Mail::Cclient stream void mail_expunge(stream) Mail::Cclient stream long mail_copy(stream, sequence, mailbox, ...) Mail::Cclient stream char *sequence char *mailbox ALIAS: move = 1 PREINIT: int i; long flags = 0; CODE: for (i = 3; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "uid")) flags |= CP_UID; else if (strEQ(flag, "move")) flags |= CP_MOVE; else { croak("unknown flag \"%s\" passed to Mail::Cclient::%s", flag, ix == 1 ? "move" : "copy"); } } if (ix == 1) flags |= CP_MOVE; RETVAL = mail_copy_full(stream, sequence, mailbox, flags); OUTPUT: RETVAL # # mail_append slightly tweaked from code submitted by # Kevin Sullivan . # long mail_append(stream, mailbox, message, date = 0, flags = 0) Mail::Cclient stream char *mailbox SV *message char *date char *flags PREINIT: STRING s; char *str; STRLEN len; CODE: str = SvPV(message, len); CCLIENT_LOCAL_INIT(&s, mail_string, (void *)str, len); RETVAL = mail_append_full(stream, mailbox, flags, date, &s); OUTPUT: RETVAL void mail_search(stream, ...) Mail::Cclient stream PREINIT: SEARCHPGM *spgm = NIL; char *search_criteria = NIL; char *cs = NIL; int i; long flags = 0; CODE: if(items < 3 || items > 7 || floor(fmod(items+1, 2))) croak("Wrong numbers of args (KEY => value)" " passed to Mail::Cclient::search"); for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "search")) search_criteria = SvPV(ST(i+1), na); else if(strcaseEQ(key, "charset")) cs = SvPV(ST(i+1), na); else if(strcaseEQ(key, "flag")) { int k; AV *avflags; SV *svflags = ST(i+1); if(SvROK(svflags) && SvTYPE(SvRV(svflags))) avflags = (AV*)SvRV(svflags); else { avflags = newAV(); av_push(avflags, svflags); } for (k = 3; k < av_len(avflags) + 1; k++) { SV **allflags = av_fetch(avflags, k, 0); char *flag = SvPV(*allflags, na); if (strEQ(flag, "uid")) flags |= SE_UID; else if (strEQ(flag, "searchfree")) flags |= SE_FREE; else if (strEQ(flag, "noprefetch")) flags |= SE_NOPREFETCH; else croak("unknown FLAG => \"%s\" value passed to" " Mail::Cclient::search", flag); } if(flags) av_undef(avflags); } else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::search", key); } if(!search_criteria) croak("no SEARCH key/value passed to Mail::Cclient::search"); if(spgm = make_criteria(search_criteria)) mail_search_full(stream, cs, spgm, flags); unsigned long mail_filter(stream, ...) Mail::Cclient stream PREINIT: STRINGLIST *lines = 0; STRLEN len = 0; SIZEDTEXT szt; MESSAGECACHE *mc; int i; long flags = 0; unsigned long msgno; CODE: if(items < 5 || items > 7 || floor(fmod(items+1, 2))) croak("Wrong numbers of args (KEY => value)" " passed to Mail::Cclient::filter"); for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "msgno")) { msgno = (unsigned long)SvUV(ST(i+1)); } else if(strcaseEQ(key, "lines")) { SV *arrayRef = ST(i+1); if(SvROK(arrayRef) && SvTYPE(SvRV(arrayRef))) { lines = av_to_stringlist((AV*)SvRV(arrayRef)); } } else if(strcaseEQ(key, "flag")) { char *flag = SvPV(ST(i+1), na); if (strEQ(flag, "not")) flags |= FT_NOT; else croak("unknown FLAG => \"%s\" value passed to" " Mail::Cclient::filter", flag); } } mc = mail_elt(stream, msgno); memset(&szt, 0, sizeof(SIZEDTEXT)); textcpy(&szt, &mc->private.msg.header.text); mail_filter((char *) szt.data, szt.size, lines, flags); # # mail_search_msg from code submitted by # Helena Gomes . # long mail_search_msg(stream, msgno, criteria, cs = NIL) Mail::Cclient stream unsigned long msgno char *criteria char *cs PREINIT: SEARCHPGM *spgm; long result = NIL; CODE: spgm = make_criteria(criteria); if(spgm) result = mail_search_msg(stream, msgno, cs, spgm); RETVAL = result; OUTPUT: RETVAL void mail_real_gc(stream, ...) Mail::Cclient stream PREINIT: int i; long flags = 0; CODE: for (i = 1; i < items; i++) { char *flag = SvPV(ST(i), na); if (strEQ(flag, "elt")) flags |= GC_ELT; else if (strEQ(flag, "env")) flags |= GC_ENV; else if (strEQ(flag, "texts")) flags |= GC_TEXTS; else croak("unknown flag \"%s\" passed to Mail::Cclient::gc", flag); } mail_gc(stream, flags); # # This is _parameters which handles a single extra argument (equivalent # to GET_FOO) or two extra arguments (equivalent to SET_FOO). The # "parameters" method in Cclient.pm handles multiple pairs of arguments # for SET_. # void mail__parameters(stream, param, sv = 0) Mail::Cclient stream char *param SV *sv PREINIT: char *res_str = 0; int res_int; PPCODE: if(strEQ(param, "USERNAME")) { if(sv) mail_parameters(stream, SET_USERNAME, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_USERNAME, 0); } else if(strEQ(param, "HOMEDIR")) { if(sv) mail_parameters(stream, SET_HOMEDIR, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_HOMEDIR, 0); } else if(strEQ(param, "LOCALHOST")) { if(sv) mail_parameters(stream, SET_LOCALHOST, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_LOCALHOST, 0); } else if(strEQ(param, "SYSINBOX")) { if(sv) mail_parameters(stream, SET_SYSINBOX, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_SYSINBOX, 0); } else if(strEQ(param, "NEWSACTIVE")) { if(sv) mail_parameters(stream, SET_NEWSACTIVE, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_NEWSACTIVE, 0); } else if (strEQ(param, "NEWSSPOOL")) { if(sv) mail_parameters(stream, SET_NEWSSPOOL, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_NEWSSPOOL, 0); } else if(strEQ(param, "NEWSRC")) { if(sv) mail_parameters(stream, SET_NEWSRC, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_NEWSRC, 0); } else if(strEQ(param, "ANONYMOUSHOME")) { if(sv) mail_parameters(stream, SET_ANONYMOUSHOME, SvPV(sv, na)); else res_str = mail_parameters(stream, GET_ANONYMOUSHOME, 0); } else if(strEQ(param, "OPENTIMEOUT")) { if(sv) mail_parameters(stream, SET_OPENTIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_OPENTIMEOUT, 0); } else if(strEQ(param, "READTIMEOUT")) { if(sv) mail_parameters(stream, SET_READTIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_READTIMEOUT, 0); } else if(strEQ(param, "WRITETIMEOUT")) { if(sv) mail_parameters(stream, SET_WRITETIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_WRITETIMEOUT, 0); } else if(strEQ(param, "CLOSETIMEOUT")) { if(sv) mail_parameters(stream, SET_CLOSETIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_CLOSETIMEOUT, 0); } else if(strEQ(param, "RSHTIMEOUT")) { if(sv) mail_parameters(stream, SET_RSHTIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_RSHTIMEOUT, 0); } else if(strEQ(param, "SSHTIMEOUT")) { if(sv) mail_parameters(stream, SET_SSHTIMEOUT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_SSHTIMEOUT, 0); } else if(strEQ(param, "SSLFAILURE")) { if(sv) mail_parameters(stream, SET_SSLFAILURE, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_SSLFAILURE, 0); } else if(strEQ(param, "MAXLOGINTRIALS")) { if(sv) mail_parameters(stream, SET_MAXLOGINTRIALS, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_MAXLOGINTRIALS, 0); } else if(strEQ(param, "LOOKAHEAD")) { if(sv) mail_parameters(stream, SET_LOOKAHEAD, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_LOOKAHEAD, 0); } else if(strEQ(param, "IMAPPORT")) { if(sv) mail_parameters(stream, SET_IMAPPORT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_IMAPPORT, 0); } else if(strEQ(param, "PREFETCH")) { if(sv) mail_parameters(stream, SET_PREFETCH, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_PREFETCH, 0); } else if(strEQ(param, "CLOSEONERROR")) { if(sv) mail_parameters(stream, SET_CLOSEONERROR, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_CLOSEONERROR, 0); } else if(strEQ(param, "POP3PORT")) { if(sv) mail_parameters(stream, SET_POP3PORT, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_POP3PORT, 0); } else if(strEQ(param, "UIDLOOKAHEAD")) { if(sv) mail_parameters(stream, SET_UIDLOOKAHEAD, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_UIDLOOKAHEAD, 0); } else if(strEQ(param, "MBXPROTECTION")) { if(sv) mail_parameters(stream, SET_MBXPROTECTION, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_MBXPROTECTION, 0); } else if(strEQ(param, "DIRPROTECTION")) { if(sv) mail_parameters(stream, SET_DIRPROTECTION, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_DIRPROTECTION, 0); } else if(strEQ(param, "LOCKPROTECTION")) { if(sv) mail_parameters(stream, SET_LOCKPROTECTION, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_LOCKPROTECTION, 0); } else if(strEQ(param, "FROMWIDGET")) { if(sv) mail_parameters(stream, SET_FROMWIDGET, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_FROMWIDGET, 0); } else if(strEQ(param, "DISABLEFCNTLLOCK")) { if(sv) mail_parameters(stream, SET_DISABLEFCNTLLOCK, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_DISABLEFCNTLLOCK, 0); } else if(strEQ(param, "LOCKEACCESERROR")) { if(sv) mail_parameters(stream, SET_LOCKEACCESERROR, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_LOCKEACCESERROR, 0); } else if(strEQ(param, "LISTMAXLEVEL")) { if(sv) mail_parameters(stream, SET_LISTMAXLEVEL, (void*)SvIV(sv)); else res_int = (int) mail_parameters(stream, GET_LISTMAXLEVEL, 0); } else { croak("no such parameter name: %s", param); } if(sv) ST(0) = &sv_yes; else { if (res_str) XPUSHs(sv_2mortal(newSVpv(res_str, 0))); else XPUSHs(sv_2mortal(newSViv(res_int))); } # # Utility Functions # void mail_debug(stream) Mail::Cclient stream void mail_nodebug(stream) Mail::Cclient stream #define mail_set_sequence(stream, seq) mail_sequence(stream, seq) long mail_set_sequence(stream, sequence) Mail::Cclient stream char *sequence #define mail_uid_set_sequence(stream, seq) mail_uid_sequence(stream, seq) long mail_uid_set_sequence(stream, sequence) Mail::Cclient stream char *sequence MODULE = Mail::Cclient PACKAGE = Mail::Cclient::SMTP PREFIX = smtp_ PROTOTYPES: DISABLE # # SMTP Functions # Mail::Cclient::SMTP smtp_open_full(package="Mail::Cclient::SMTP", ...) char *package PREINIT: char **hostlist = NIL; char *service = "smtp"; unsigned long port = SMTPTCPPORT; long options = NIL; I32 n; int i; CODE: if(items < 3 || items > 7 || floor(fmod(items+1, 2))) croak("Wrong numbers of args (KEY => value)" " passed to Mail::Cclient::SMTP::smtp_open_full"); for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "hostlist")) { int k; AV *av_hl; SV *sv_hl = ST(i+1); if(SvROK(sv_hl) && SvTYPE(SvRV(sv_hl))) av_hl = (AV*)SvRV(sv_hl); else { av_hl = newAV(); av_push(av_hl, sv_hl); } n = av_len(av_hl) + 1; New(0, hostlist, n * sizeof(char *), char*); for (k = 0; k < n; k++) { SV **h = av_fetch(av_hl, k, 0); char *host = SvPV(*h, na); hostlist[k] = host; } } else if(strcaseEQ(key, "service")) service = SvPV(ST(i+1), na); else if(strcaseEQ(key, "port")) port = (unsigned long)SvUV(ST(i+1)); else if(strcaseEQ(key, "options")) { int k; AV *av_options; SV *sv_options = ST(i+1); if(SvROK(sv_options) && SvTYPE(SvRV(sv_options))) av_options = (AV*)SvRV(sv_options); else { av_options = newAV(); av_push(av_options, sv_options); } for(k = 0; k < av_len(av_options) + 1; k++) { SV **sv_opt = av_fetch(av_options, k, 0); char *option = SvPV(*sv_opt, na); if(strEQ(option, "debug")) options |= SOP_DEBUG; else if(strEQ(option, "dsn")) options |= SOP_DSN; else if(strEQ(option, "dsn_notify_failure")) options |= SOP_DSN_NOTIFY_FAILURE; else if(strEQ(option, "dsn_notify_delay")) options |= SOP_DSN_NOTIFY_DELAY; else if(strEQ(option, "dsn_notify_success")) options |= SOP_DSN_NOTIFY_SUCCESS; else if(strEQ(option, "dsn_return_full")) options |= SOP_DSN_RETURN_FULL; else if(strEQ(option, "8bitmime")) options |= SOP_8BITMIME; else if(strEQ(option, "secure")) options |= SOP_SECURE; else if(strEQ(option, "tryssl")) options |= SOP_TRYSSL; else if(strEQ(option, "tryalt")) options |= SOP_TRYSSL; else croak("unknown option \"%s\" passed to" " Mail::Cclient::SMTP::open_full", option); } } else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::SMTP::smtp_open_full", key); } if(!hostlist) croak("no hostlist key/value passed to Mail::Cclient::SMTP::smtp_open_full"); RETVAL = smtp_open_full(NIL, hostlist, service, port, options); if(hostlist) Safefree(hostlist); if(!RETVAL) XSRETURN_UNDEF; OUTPUT: RETVAL long smtp_mail(stream, ...) Mail::Cclient::SMTP stream PREINIT: ENVELOPE *env = NULL; BODY *body = NULL; SV *svenv = NULL, *svbody = NULL; char *trans = "MAIL"; char *dhost = "no host"; PerlIO *fp = NULL; int i; CODE: for(i = 1; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "defaulthost")) dhost = SvPV(ST(i+1), na); else if(strcaseEQ(key, "transaction")) trans = ucase(SvPV(ST(i+1), na)); else if(strcaseEQ(key, "filehandle")) fp = IoIFP(sv_2io(ST(i+1))); else if(strcaseEQ(key, "envelope")) svenv = ST(i+1); else if(strcaseEQ(key, "body")) svbody = ST(i+1); else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::SMTP::smtp_mail", key); } if(svenv) { if(SvROK(svenv) && SvTYPE(SvRV(svenv)) == SVt_PVHV) { env = mail_newenvelope(); make_mail_envelope(env, dhost, (HV*)SvRV(svenv)); } else { croak("envelope is not hash reference"); XSRETURN_UNDEF; } } else { croak("no such envelope hash reference"); XSRETURN_UNDEF; } if(svbody) { if(SvROK(svbody) && SvTYPE(SvRV(svbody)) == SVt_PVHV) { body = mail_newbody(); make_mail_body(body, (HV*)SvRV(svbody)); } else { croak("body is not hash reference"); XSRETURN_UNDEF; } } else { croak("no such body hash reference"); XSRETURN_UNDEF; } RETVAL = smtp_mail(stream, trans, env, body); if(fp) save_rfc822_tmp(env, body, fp); OUTPUT: RETVAL void smtp_debug(stream, ...) Mail::Cclient::SMTP stream CODE: stream->debug = T; void smtp_nodebug(stream, ...) Mail::Cclient::SMTP stream CODE: stream->debug = NIL; void smtp_close(stream, ...) Mail::Cclient::SMTP stream CODE: smtp_close(stream); MODULE = Mail::Cclient PACKAGE = Mail::Cclient # # MIME type conversion functions # void rfc822_base64(source) SV *source PREINIT: STRLEN srcl; unsigned long len; unsigned char *s; PPCODE: s = (unsigned char*)SvPV(source, srcl); s = rfc822_base64(s, (unsigned long)srcl, &len); XPUSHs(sv_2mortal((s) ? newSVpvn((char*)s, (STRLEN)len) : newSVpv("", 0))); void rfc822_binary(source) SV *source PREINIT: STRLEN srcl; unsigned long len; unsigned char *s; PPCODE: s = (unsigned char*)SvPV(source, srcl); s = rfc822_binary((void *) s, (unsigned long)srcl, &len); XPUSHs(sv_2mortal((s) ? newSVpvn((char*)s, (STRLEN)len) : newSVpv("", 0))); void rfc822_qprint(source) SV *source PREINIT: STRLEN srcl; unsigned long len; unsigned char *s; PPCODE: s = (unsigned char*)SvPV(source, srcl); s = rfc822_qprint(s, (unsigned long)srcl, &len); XPUSHs(sv_2mortal((s) ? newSVpvn((char*)s, (STRLEN)len) : newSVpv("", 0))); void rfc822_8bit(source) SV *source PREINIT: STRLEN srcl; unsigned long len; unsigned char *s; PPCODE: s = (unsigned char*)SvPV(source, srcl); s = rfc822_8bit(s, (unsigned long)srcl, &len); XPUSHs(sv_2mortal((s) ? newSVpvn((char*)s, (STRLEN)len) : newSVpv("", 0))); void utf8_mime2text(source) SV *source PREINIT: SIZEDTEXT src; SIZEDTEXT dst; STRLEN srcl; unsigned char *ptr; PPCODE: ptr = (unsigned char*)SvPV(source, srcl); src.data = ptr; src.size = (unsigned long)srcl; utf8_mime2text(&src, &dst); XPUSHs(sv_2mortal(newSVpv((char*)dst.data, (STRLEN)dst.size))); # # Utility functions # char * rfc822_date() PREINIT: static char date[DATE_BUFF_SIZE]; CODE: rfc822_date(date); RETVAL = date; OUTPUT: RETVAL void rfc822_parse_adrlist(string, host) char * string char * host PREINIT: ENVELOPE *env; PPCODE: env = mail_newenvelope(); rfc822_parse_adrlist(&env->to, string, host); XPUSHs(env->to ? sv_2mortal(newRV_noinc((SV*)make_address(env->to))) : &sv_undef); char * rfc822_write_address(mailbox, host, personal) char * mailbox char * host char * personal PREINIT: ADDRESS *addr; char string[MAILTMPLEN]; CODE: addr = mail_newaddr(); addr->mailbox = mailbox; addr->host = host; addr->personal = personal; addr->next=NIL; addr->error=NIL; addr->adl=NIL; string[0]='\0'; rfc822_write_address(string, addr); RETVAL = string; OUTPUT: RETVAL long rfc822_output(...) PREINIT: char tmp[8*MAILTMPLEN]; ENVELOPE *env = NULL; BODY *body = NULL; SV *svenv = NULL, *svbody = NULL; char *dhost = "no host"; PerlIO *fp = NULL; int i; CODE: for(i = 0; i < items; i = i + 2) { char *key = SvPV(ST(i), na); if(strcaseEQ(key, "defaulthost")) dhost = SvPV(ST(i+1), na); else if(strcaseEQ(key, "filehandle")) fp = IoIFP(sv_2io(ST(i+1))); else if(strcaseEQ(key, "envelope")) svenv = ST(i+1); else if(strcaseEQ(key, "body")) svbody = ST(i+1); else croak("unknown \"%s\" keyword passed to" " Mail::Cclient::rfc822_output",key); } if(svenv) { if(SvROK(svenv) && SvTYPE(SvRV(svenv)) == SVt_PVHV) { env = mail_newenvelope(); make_mail_envelope(env, dhost, (HV*)SvRV(svenv)); } else { croak("envelope is not hash reference"); XSRETURN_UNDEF; } } else { croak("no such envelope hash reference"); XSRETURN_UNDEF; } if(svbody) { if(SvROK(svbody) && SvTYPE(SvRV(svbody)) == SVt_PVHV) { body = mail_newbody(); make_mail_body(body, (HV*)SvRV(svbody)); } else { croak("body is not hash reference"); XSRETURN_UNDEF; } } else { croak("no such body hash reference"); XSRETURN_UNDEF; } RETVAL = rfc822_output(tmp, env, body, transfer, fp, 1); OUTPUT: RETVAL BOOT: #ifdef HAVE_IMAP_LINKAGE #include "linkage.c" #else mail_link (&mboxdriver); /* link in the mbox driver */ mail_link (&imapdriver); /* link in the imap driver */ mail_link (&nntpdriver); /* link in the nntp driver */ mail_link (&pop3driver); /* link in the pop3 driver */ mail_link (&mhdriver); /* link in the mh driver */ mail_link (&mxdriver); /* link in the mx driver */ mail_link (&mbxdriver); /* link in the mbx driver */ mail_link (&tenexdriver); /* link in the tenex driver */ mail_link (&mtxdriver); /* link in the mtx driver */ mail_link (&mmdfdriver); /* link in the mmdf driver */ mail_link (&unixdriver); /* link in the unix driver */ mail_link (&newsdriver); /* link in the news driver */ mail_link (&philedriver); /* link in the phile driver */ mail_link (&dummydriver); /* link in the dummy driver */ auth_link (&auth_md5); /* link in the md5 authenticator */ auth_link (&auth_pla); /* link in the pla authenticator */ auth_link (&auth_log); /* link in the log authenticator */ #ifdef HAVE_IMAP_SSL ssl_onceonlyinit (); #endif /* HAVE_IMAP_SSL */ #endif /* HAVE_IMAP_LINKAGE */ mailstream2sv = newHV(); stash_Cclient = gv_stashpv("Mail::Cclient", TRUE); stash_Address = gv_stashpv("Mail::Cclient::Address", TRUE); stash_Envelope = gv_stashpv("Mail::Cclient::Envelope", TRUE); stash_Body = gv_stashpv("Mail::Cclient::Body", TRUE); stash_Elt = gv_stashpv("Mail::Cclient::Elt", TRUE); callback = perl_get_hv("Mail::Cclient::_callback", TRUE); address_fields = newRV((SV*)perl_get_hv("Mail::Cclient::" "Address::FIELDS", TRUE)); envelope_fields = newRV((SV*)perl_get_hv("Mail::Cclient::" "Envelope::FIELDS", TRUE)); body_fields = newRV((SV*)perl_get_hv("Mail::Cclient::Body::FIELDS", TRUE)); elt_fields = newRV((SV*)perl_get_hv("Mail::Cclient::Elt::FIELDS", TRUE)); Mail-Cclient-1.12/Makefile.PL0000644000076400007640000001154110132016730016307 0ustar wwwadminweb00000000000000# See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. # Last Modification: Wed Oct 6 13:30:32 WEST 2004 use ExtUtils::MakeMaker; use Getopt::Long(); use vars qw($opt); my ($CCLIENTLIBS, $CCLIENT_DIR, $PAM_DIR, $SSL_DIR, $KRB_DIR, $IMAP_DIR); my @objects = (); my $opt = {}; Getopt::Long::GetOptions($opt, "help" => \&usage, "cclient_dir=s" => \$CCLIENT_DIR, "with-shared_cclient" => sub { $CCLIENTLIBS = " -lc-client"; }, "with-pam:s" => \$PAM_DIR, "with-ssl:s" => \$SSL_DIR, "with-kerberos:s" => \$KRB_DIR, "with-cclient-includes=s" => \$IMAP_DIR, ) or die < [--help]\n" unless($CCLIENT_DIR); die "CCLIENT_DIR $CCLIENT_DIR does not contain c-client.a\n" if(!-r "$CCLIENT_DIR/c-client.a"); } my %headers = (); my $osname = lc($^O); my @libs = "-lc"; push(@libs, "-lm") if($osname eq "aix"); $LIBS = join(" ", @libs); if($CCLIENTLIBS) { print "configure with shared c-client:$CCLIENTLIBS\n"; $LIBS .= $CCLIENTLIBS; if($IMAP_DIR) { $CCLIENT_DIR = $IMAP_DIR; $headers{'HAVE_IMAP_LINKAGE'} = 1 if(-e "$IMAP_DIR/linkage.c"); } } if(defined($PAM_DIR)) { my $tmp = " -L$PAM_DIR" if($PAM_DIR); $tmp .= " -lpam -lpam_misc"; print "configure with pam:$tmp\n"; $LIBS .= $tmp; } if(defined($SSL_DIR)) { my $tmp = " -L$SSL_DIR" if($SSL_DIR); $tmp .= " -lcrypto -lssl"; print "configure with ssl:$tmp\n"; $LIBS .= $tmp; $headers{'HAVE_IMAP_SSL'} = 1; } if(defined($KRB_DIR)) { my $tmp = " -L$KRB_DIR" if($KRB_DIR); $tmp .= " -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"; print "configure with kerberos:$tmp\n"; $LIBS .= $tmp; } unlink("Cclient.h") if(-e "Cclient.h"); open(HEADERS, ">", "Cclient.h") or die("$!"); while(my ($key, $value) = each(%headers)) { print HEADERS "#define $key $value\n"; } close(HEADERS); unless($CCLIENTLIBS) { # # We want to turn Cclient.o (ours) plus the object files in the # $CCLIENT_DIR/c-client.a archive into a shared object. Simply # including both in the MakeMaker OBJECT list works fine for Linux # but under Digital UNIX, the combination of its ar and "ld -shared" # can't cope with simply "ar cr tmp.a Cclient.o .../c-client.a". # To get around that look at the contents of the c-client.a archive # and extract all .o files from it into the current directory. Then # we set OBJECT to be our Cclient.o plus all of those. Blech. # my @contents = (); print "Examining archive file $CCLIENT_DIR/c-client.a...\n"; chomp(@contents = `ar t $CCLIENT_DIR/c-client.a`); @objects = grep(/\.o$/, @contents); print "Extracting object files from archive: ", join(", ", @objects), "\n"; system("ar", "x", "$CCLIENT_DIR/c-client.a", @objects); my $err = $? >> 8; if ($err) { print < "Mail::Cclient", VERSION_FROM => "Cclient.pm", INC => "-I$CCLIENT_DIR", LIBS => ["$LIBS"], OBJECT => "@objects" ); exit(0); sub usage { print STDERR <<"USAGE"; Usage: perl $0 [options] Possible options are: --cclient_dir= Where is the pathname of the directory which contains the c-client.a archive library which you have just built. --with-shared_cclient Configure with support for a shared c-client library --with-pam= Configure with support for PAM. Where is the pathname of the directory which contains the libs. is optional. --with-ssl= Configure with support for SSL Where is the pathname of the directory which contains the libs. is optional. --with-kerberos= Configure with support for Kerberos Where is the pathname of the directory which contains the libs. is optional. --with-cclient-includes= Where the c-client header files live --help Print this message and exit USAGE exit 1; }