PageRenderTime 20ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/Core/KSOmahaServer.h

http://macfuse.googlecode.com/
C++ Header | 56 lines | 18 code | 8 blank | 30 comment | 0 complexity | bd9afe46f1677f99e893ced44bc4b2d5 MD5 | raw file
 1// Copyright 2009 Google Inc.
 2//
 3// Licensed under the Apache License, Version 2.0 (the "License");
 4// you may not use this file except in compliance with the License.
 5// You may obtain a copy of the License at
 6//
 7//     http://www.apache.org/licenses/LICENSE-2.0
 8//
 9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#import <Foundation/Foundation.h>
16#import "KSServer.h"
17
18// Key into an out-of-band data dictionary.  Value is an NSNumber-wrapped
19// integer which is the number of seconds since midnight, server-time.
20#define KSOmahaServerSecondsSinceMidnightKey @"SecondsSinceMidnight"
21
22@class KSStatsCollection;
23@class KSClientActives;
24
25// Do Omaha specific things for creating NSURLRequests and responses.
26// For example, this class converts KSTickets into XML requests for an
27// Omaha server, and knows how to convert an Omaha XML response into
28// KSUpdateActions.
29@interface KSOmahaServer : KSServer {
30 @private
31  NSXMLElement *root_;  // weak
32  NSXMLDocument *document_;
33  KSClientActives *actives_;
34  int secondsSinceMidnight_;
35}
36
37// Return an autoreleased KSOmahaServer which points to the given URL.
38// |params| is a dictionary of parameters as defined by our owner, or
39// nil to use defaults.  |engine| is an update engine whose delegate
40// may be called, or use nil to not use one.
41// See KSUpdateEngineParameters.h for the keys.  Defaults are generally
42// not what you want except for unit testing.
43+ (id)serverWithURL:(NSURL *)url params:(NSDictionary *)params;
44+ (id)serverWithURL:(NSURL *)url params:(NSDictionary *)params
45             engine:(KSUpdateEngine *)engine;
46
47// Initializer that uses default params for cases where we don't care
48// (e.g. unit tests).
49+ (id)serverWithURL:(NSURL *)url;
50
51// Returns an NSURLRequest object to use for uploading the |stats| to the
52// Omaha sever specified by |url|. The NSURLRequest object represents a POST
53// with an XML body containing all the stats from |stats|.
54- (NSURLRequest *)requestForStats:(KSStatsCollection *)stats;
55
56@end