Adds test package
This splits out the mock libvirt server for testing within other packages. Constants from the main libvirt package have been moved to a separate package, constants, for shared access.
This commit is contained in:
		
							
								
								
									
										54
									
								
								internal/constants/constants.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								internal/constants/constants.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| // Copyright 2016 The go-libvirt Authors. | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //   http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // Package constants provides shared data for the libvirt package. | ||||
| package constants | ||||
|  | ||||
| // magic program numbers | ||||
| // see: https://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/remote/remote_protocol.x;hb=HEAD | ||||
| const ( | ||||
| 	ProgramVersion   = 1 | ||||
| 	ProgramRemote    = 0x20008086 | ||||
| 	ProgramQEMU      = 0x20008087 | ||||
| 	ProgramKeepAlive = 0x6b656570 | ||||
| ) | ||||
|  | ||||
| // libvirt procedure identifiers | ||||
| const ( | ||||
| 	ProcConnectOpen           = 1 | ||||
| 	ProcConnectClose          = 2 | ||||
| 	ProcDomainLookupByName    = 23 | ||||
| 	ProcAuthList              = 66 | ||||
| 	ProcConnectGetLibVersion  = 157 | ||||
| 	ProcConnectListAllDomains = 273 | ||||
| ) | ||||
|  | ||||
| // qemu procedure identifiers | ||||
| const ( | ||||
| 	QEMUDomainMonitor                       = 1 | ||||
| 	QEMUConnectDomainMonitorEventRegister   = 4 | ||||
| 	QEMUConnectDomainMonitorEventDeregister = 5 | ||||
| 	QEMUDomainMonitorEvent                  = 6 | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	// PacketLengthSize is the packet length, in bytes. | ||||
| 	PacketLengthSize = 4 | ||||
|  | ||||
| 	// HeaderSize is the packet header size, in bytes. | ||||
| 	HeaderSize = 24 | ||||
|  | ||||
| 	// UUIDSize is the length of a UUID, in bytes. | ||||
| 	UUIDSize = 16 | ||||
| ) | ||||
		Reference in New Issue
	
	Block a user