/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. #import <Foundation/Foundation.h>
  15. #import "KSServer.h"
  16. // Key into an out-of-band data dictionary. Value is an NSNumber-wrapped
  17. // integer which is the number of seconds since midnight, server-time.
  18. #define KSOmahaServerSecondsSinceMidnightKey @"SecondsSinceMidnight"
  19. @class KSStatsCollection;
  20. @class KSClientActives;
  21. // Do Omaha specific things for creating NSURLRequests and responses.
  22. // For example, this class converts KSTickets into XML requests for an
  23. // Omaha server, and knows how to convert an Omaha XML response into
  24. // KSUpdateActions.
  25. @interface KSOmahaServer : KSServer {
  26. @private
  27. NSXMLElement *root_; // weak
  28. NSXMLDocument *document_;
  29. KSClientActives *actives_;
  30. int secondsSinceMidnight_;
  31. }
  32. // Return an autoreleased KSOmahaServer which points to the given URL.
  33. // |params| is a dictionary of parameters as defined by our owner, or
  34. // nil to use defaults. |engine| is an update engine whose delegate
  35. // may be called, or use nil to not use one.
  36. // See KSUpdateEngineParameters.h for the keys. Defaults are generally
  37. // not what you want except for unit testing.
  38. + (id)serverWithURL:(NSURL *)url params:(NSDictionary *)params;
  39. + (id)serverWithURL:(NSURL *)url params:(NSDictionary *)params
  40. engine:(KSUpdateEngine *)engine;
  41. // Initializer that uses default params for cases where we don't care
  42. // (e.g. unit tests).
  43. + (id)serverWithURL:(NSURL *)url;
  44. // Returns an NSURLRequest object to use for uploading the |stats| to the
  45. // Omaha sever specified by |url|. The NSURLRequest object represents a POST
  46. // with an XML body containing all the stats from |stats|.
  47. - (NSURLRequest *)requestForStats:(KSStatsCollection *)stats;
  48. @end