1 # ---------------------------------------------------------------
2 # Copyright © 2014 Jason J.A. Stephenson <jason@sigio.com>
4 # This file is part of NCIPServer.
6 # NCIPServer is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # NCIPServer is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with NCIPServer. If not, see <http://www.gnu.org/licenses/>.
18 # ---------------------------------------------------------------
23 my $class = ref $invocant || $invocant;
24 my $self = bless {@_}, $class;
28 # Methods required for SHAREit:
33 sub cancelrequestitem {
51 # Other methods, just because.
53 # Handle a LookupVersion Request. You probably want to just call this
54 # one from your subclasses rather than reimplement it.
58 # A few helper methods:
60 # All subclasses will possibly want to create a ResponseHeader and the
61 # code for that would be highly redundant. We supply a default
62 # implementation here that can retrieve the agency information from
63 # the InitiationHeader of the message, swap their values, and return a
72 for my $key (keys %$request) {
73 if ($request->{$key}->{InitiationHeader}) {
74 $initheader = $request->{$key}->{InitiationHeader};
79 if ($initheader && $initheader->{FromAgencyId}
80 && $initheader->{ToAgencyId}) {
81 $header = NCIP::Header->new(
82 FromAgencyId => $initheader->{ToAgencyId},
83 ToAgencyId => $initheader->{FromAgencyId}