-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding generated protocol sources to git
- Loading branch information
Showing
1,698 changed files
with
138,028 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...x11-protocol-bigreq/src/main/java/com/github/moaxcp/x11/protocol/bigreq/BigreqPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package com.github.moaxcp.x11.protocol.bigreq; | ||
|
||
import com.github.moaxcp.x11.protocol.X11Input; | ||
import com.github.moaxcp.x11.protocol.XError; | ||
import com.github.moaxcp.x11.protocol.XEvent; | ||
import com.github.moaxcp.x11.protocol.XGenericEvent; | ||
import com.github.moaxcp.x11.protocol.XProtocolPlugin; | ||
import com.github.moaxcp.x11.protocol.XRequest; | ||
import java.io.IOException; | ||
import java.util.Optional; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
public class BigreqPlugin implements XProtocolPlugin { | ||
@Getter | ||
@Setter | ||
private byte majorOpcode; | ||
|
||
@Getter | ||
@Setter | ||
private byte firstEvent; | ||
|
||
@Getter | ||
@Setter | ||
private byte firstError; | ||
|
||
public String getPluginName() { | ||
return "bigreq"; | ||
} | ||
|
||
public Optional<String> getExtensionXName() { | ||
return Optional.ofNullable("BIG-REQUESTS"); | ||
} | ||
|
||
public Optional<String> getExtensionName() { | ||
return Optional.ofNullable("BigRequests"); | ||
} | ||
|
||
public Optional<Boolean> getExtensionMultiword() { | ||
return Optional.ofNullable(true); | ||
} | ||
|
||
public Optional<Byte> getMajorVersion() { | ||
return Optional.ofNullable((byte) 0); | ||
} | ||
|
||
public Optional<Byte> getMinorVersion() { | ||
return Optional.ofNullable((byte) 0); | ||
} | ||
|
||
@Override | ||
public boolean supportedRequest(XRequest request) { | ||
return request.getPluginName().equals(getPluginName()); | ||
} | ||
|
||
@Override | ||
public boolean supportedRequest(byte majorOpcode, byte minorOpcode) { | ||
boolean isMajorOpcode = majorOpcode == getMajorOpcode(); | ||
if(minorOpcode == 0) { | ||
return isMajorOpcode; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean supportedEvent(byte number) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean supportedError(byte code) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public XRequest readRequest(byte majorOpcode, byte minorOpcode, X11Input in) throws IOException { | ||
if(minorOpcode == Enable.OPCODE) { | ||
return Enable.readEnable(in); | ||
} | ||
throw new IllegalArgumentException("majorOpcode " + majorOpcode + ", minorOpcode " + minorOpcode + " is not supported"); | ||
} | ||
|
||
@Override | ||
public XEvent readEvent(byte number, boolean sentEvent, X11Input in) throws IOException { | ||
throw new IllegalArgumentException("number " + number + " is not supported"); | ||
} | ||
|
||
@Override | ||
public XError readError(byte code, X11Input in) throws IOException { | ||
throw new IllegalArgumentException("code " + code + " is not supported"); | ||
} | ||
|
||
@Override | ||
public XGenericEvent readGenericEvent(boolean sentEvent, byte extension, short sequenceNumber, | ||
int length, short eventType, X11Input in) throws IOException { | ||
throw new IllegalArgumentException("eventType " + eventType + " is not supported"); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...tocol/x11-protocol-bigreq/src/main/java/com/github/moaxcp/x11/protocol/bigreq/Enable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.github.moaxcp.x11.protocol.bigreq; | ||
|
||
import com.github.moaxcp.x11.protocol.TwoWayRequest; | ||
import com.github.moaxcp.x11.protocol.X11Input; | ||
import com.github.moaxcp.x11.protocol.X11Output; | ||
import com.github.moaxcp.x11.protocol.XReplyFunction; | ||
import java.io.IOException; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder | ||
public class Enable implements TwoWayRequest<EnableReply> { | ||
public static final String PLUGIN_NAME = "bigreq"; | ||
|
||
public static final byte OPCODE = 0; | ||
|
||
public XReplyFunction<EnableReply> getReplyFunction() { | ||
return (field, sequenceNumber, in) -> EnableReply.readEnableReply(field, sequenceNumber, in); | ||
} | ||
|
||
public byte getOpCode() { | ||
return OPCODE; | ||
} | ||
|
||
public static Enable readEnable(X11Input in) throws IOException { | ||
Enable.EnableBuilder javaBuilder = Enable.builder(); | ||
byte majorOpcode = in.readCard8(); | ||
short length = in.readCard16(); | ||
return javaBuilder.build(); | ||
} | ||
|
||
@Override | ||
public void write(byte majorOpcode, X11Output out) throws IOException { | ||
out.writeCard8(majorOpcode); | ||
out.writeCard8((byte)(Byte.toUnsignedInt(OPCODE))); | ||
out.writeCard16((short) getLength()); | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return 4; | ||
} | ||
|
||
public String getPluginName() { | ||
return PLUGIN_NAME; | ||
} | ||
|
||
public static class EnableBuilder { | ||
public int getSize() { | ||
return 4; | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../x11-protocol-bigreq/src/main/java/com/github/moaxcp/x11/protocol/bigreq/EnableReply.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.moaxcp.x11.protocol.bigreq; | ||
|
||
import com.github.moaxcp.x11.protocol.X11Input; | ||
import com.github.moaxcp.x11.protocol.X11Output; | ||
import com.github.moaxcp.x11.protocol.XReply; | ||
import java.io.IOException; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder | ||
public class EnableReply implements XReply { | ||
public static final String PLUGIN_NAME = "bigreq"; | ||
|
||
private short sequenceNumber; | ||
|
||
private int maximumRequestLength; | ||
|
||
public static EnableReply readEnableReply(byte pad1, short sequenceNumber, X11Input in) throws | ||
IOException { | ||
EnableReply.EnableReplyBuilder javaBuilder = EnableReply.builder(); | ||
int length = in.readCard32(); | ||
int maximumRequestLength = in.readCard32(); | ||
in.readPad(20); | ||
javaBuilder.sequenceNumber(sequenceNumber); | ||
javaBuilder.maximumRequestLength(maximumRequestLength); | ||
return javaBuilder.build(); | ||
} | ||
|
||
@Override | ||
public void write(X11Output out) throws IOException { | ||
out.writeCard8(getResponseCode()); | ||
out.writePad(1); | ||
out.writeCard16(sequenceNumber); | ||
out.writeCard32(getLength()); | ||
out.writeCard32(maximumRequestLength); | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return 12; | ||
} | ||
|
||
public String getPluginName() { | ||
return PLUGIN_NAME; | ||
} | ||
|
||
public static class EnableReplyBuilder { | ||
public int getSize() { | ||
return 12; | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...igreq/src/main/resources/META-INF/services/com.github.moaxcp.x11.protocol.XProtocolPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.github.moaxcp.x11.protocol.bigreq.BigreqPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.