# Path: mom/unixrpc.py
# class UnixXmlRpcServer(socketserver.UnixStreamServer,
#                        xmlrpc_server.SimpleXMLRPCDispatcher):
#     address_family = socket.AF_UNIX
#     allow_address_reuse = True
# 
#     def __init__(self, sock_path, request_handler=UnixXmlRpcHandler,
#                  logRequests=0):
#         if os.path.exists(sock_path):
#             os.unlink(sock_path)
#         self.logRequests = logRequests
#         xmlrpc_server.SimpleXMLRPCDispatcher.__init__(self,
#                                                            encoding=None,
#                                                            allow_none=1)
#         socketserver.UnixStreamServer.__init__(self, sock_path,
#                                                request_handler)


import threading
import six
from six.moves.xmlrpc_client import Marshaller
from six.moves.xmlrpc_server import SimpleXMLRPCServer
from six.moves.xmlrpc_server import SimpleXMLRPCRequestHandler
from .unixrpc import UnixXmlRpcServer
from .LogUtils import *
# Memory Overcommitment Manager
# Copyright (C) 2010 Adam Litke, IBM Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA



def big_int_marshaller(m, value, writer):
    if value >= 2**31 or value <= -2**31:
        writer("<value><i8>%d</i8></value>" % value)
    else:

# Path: mom/unixrpc.py
# class UnixXmlRpcServer(socketserver.UnixStreamServer,
#                        xmlrpc_server.SimpleXMLRPCDispatcher):
#     address_family = socket.AF_UNIX
#     allow_address_reuse = True
# 
#     def __init__(self, sock_path, request_handler=UnixXmlRpcHandler,
#                  logRequests=0):
#         if os.path.exists(sock_path):
#             os.unlink(sock_path)
#         self.logRequests = logRequests
#         xmlrpc_server.SimpleXMLRPCDispatcher.__init__(self,
#                                                            encoding=None,
#                                                            allow_none=1)
#         socketserver.UnixStreamServer.__init__(self, sock_path,
#                                                request_handler)


# Path: mom/RPCServer.py
import threading
import six
from six.moves.xmlrpc_client import Marshaller
from six.moves.xmlrpc_server import SimpleXMLRPCServer
from six.moves.xmlrpc_server import SimpleXMLRPCRequestHandler
from .unixrpc import UnixXmlRpcServer
from .LogUtils import *

# Memory Overcommitment Manager
# Copyright (C) 2010 Adam Litke, IBM Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA



def big_int_marshaller(m, value, writer):
    if value >= 2**31 or value <= -2**31:
        writer("<value><i8>%d</i8></value>" % value)
    else:

        writer("<value><int>%d</int></value>" % value)