virportallocator.h 1.5 KB
Newer Older
D
Daniel P. Berrange 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
 * virportallocator.h: Allocate & track TCP port allocations
 *
 * Copyright (C) 2013 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __VIR_PORT_ALLOCATOR_H__
# define __VIR_PORT_ALLOCATOR_H__

# include "internal.h"
# include "virobject.h"

typedef struct _virPortAllocator virPortAllocator;
typedef virPortAllocator *virPortAllocatorPtr;

J
Ján Tomko 已提交
31 32
virPortAllocatorPtr virPortAllocatorNew(const char *name,
                                        unsigned short start,
D
Daniel P. Berrange 已提交
33 34 35 36 37 38 39 40
                                        unsigned short end);

int virPortAllocatorAcquire(virPortAllocatorPtr pa,
                            unsigned short *port);

int virPortAllocatorRelease(virPortAllocatorPtr pa,
                            unsigned short port);

41 42 43 44
int virPortAllocatorSetUsed(virPortAllocatorPtr pa,
                            unsigned short port,
                            bool value);

D
Daniel P. Berrange 已提交
45
#endif /* __VIR_PORT_ALLOCATOR_H__ */